- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
MeroDN · Mar 11, 2015 at 09:29 AM ·
raycastraycastingdirectiondetection
How can I make a raycast move towards an object?
I want to detect if a wall is between two objects. How do I project a raycast towards an object?
Comment
Answer by NoseKills · Mar 11, 2015 at 11:57 AM
Vector3 dir = otherObject.transform.position - transform.position;
if (Physics.Raycast(transform.position, dir, dir.magnitude))
Your answer
Follow this Question
Related Questions
Raycast not detecting a hit from far away, it only detects when close. 0 Answers
Raycasting with Rotation of Camera 0 Answers
raycast position & directions 1 Answer
ray cast not working ? 2 Answers
Raycast From Within An Object 1 Answer