The player's tank and the aspect class
The Target object is a simple sphere object with the mesh render disabled. We have also created a point light and made it a child of our Target object. Make sure that the light is centered, or it will not be very helpful.
Look at the following code in the Target.cs file:
using UnityEngine;
public class Target : MonoBehaviour {
[SerializeField]
private float hOffset = 0.2f;
void Update () {
int button = 0;
//Get the point of the hit position when the mouse
//is being clicked
if(Input.GetMouseButtonDown(button)) {
Ray ray = Camera.main.ScreenPointToRay(
...