Question by
MGMaddMann · Sep 14, 2015 at 03:41 PM ·
raycastcarangle
How do I find a certain angle of a raycast?
I'm currently trying to make my car turn to face a certain target object.
I am sending a raycast from the car to the target, but I am struggling to work out how to find out what angle the raycast is emitting from the car.
How can I do this?
Comment
Answer by hexagonius · Sep 14, 2015 at 05:34 PM
If you mean the angle between your car's forward and the direction of your raycast:
float angle = Vector3.Angle(raycast.direction, car.forward);
Your answer
