I’m having trouble getting the vector3 direction value from a set of world coordinates. This is for a 3rd person shooter. Basically I want the character to shoot at where I’m pointing with the cross hairs. What I’m doing is:
A raycast from the camera position directly ahead. This gives me the hit point where the user is aiming with the cross hairs.
Then I’m doing a 2nd raycast from the character towards the direction of the hit point of the first ray cast.
The problem is that the raycast function takes a vector3 direction as its 2nd argument, not a vector3 point.
What I need to do is convert the world space coordinates from the first raycast hit point, in to a vector3 direction value that I can feed in to the 2nd raycast. Can someone tell me how to do this?
Let me know if this makes sense and thanks in advance.
Hey Aubergine, thanks for that, works like a charm
I should have come here hours ago. I wasted about half a day trying to figure that out, haha. Well at least I had a good read of the the documentation anyway,