I’m trying to get a raycast to raycast in the direction of a certain object. This is how I attempted to do it:
Vector3 relativePos = objT.transform.position - plane.position; Quaternion rot = Quaternion.LookRotation(relativePos); float distance = Vector3.Distance(plane.position, objT.transform.position); Physics.Raycast(plane.position, rot, out hit, distance);
But I get this error that makes no sense to me:
The best overloaded match for ‘UnityEngine.Physics.Raycast(UnityEngine.Vector3, UnityEngine.Vector3, float, int)’ has some invalid arguments.
Which makes no sense because the second part is a quaternion, not a Vector3. Anything I’m doing wrong, and is there another better way to do what I’m trying to do? If there is, please explain but still explain to me what I did wrong here. If there isn’t…well then just answer the question. Thanks in advance.