Hi! I’m trying to do a simple thing: do a Raycast from one object to another and register the hit position by placing a little red sphere “redDot” there. But for some reason my sphere moves infinitely from the hit position to raycast origin. Here’s my code:
public GameObject redDot; // red sphere private Ray dwn; void Start () { dwn = new Ray (transform.position, Vector3.down); } void Update () { RaycastHit hit; if (Physics.Raycast (dwn, out hit)) redDot.transform.position = hit.point; Debug.Log (hit.point); } ` `