Question by
skoteskote · Sep 28, 2021 at 11:14 AM ·
rotationvector3quaterniondegree
Get angle between direction and plane
Hi, I have banged my head about this for a while now and seem to be too stupid to understand how to solve it. How would I go about to get the angle of x in the picture? (Ie the angle between the blue line and the plane)
unknown.png
(96.1 kB)
Comment
Best Answer
Answer by skoteskote · Sep 29, 2021 at 04:25 PM
This thread had it all. For the lazy:
Ray ray = new Ray(transform.position, transform.forward);
if (Physics.Raycast(ray, out RaycastHit hit, 100))
{
float angle = Vector3.Angle(hit.normal, -ray.direction);
}
Your answer
Follow this Question
Related Questions
Rotating 3d person character 0 Answers
Grabbing the Relative eulerAngles.y of a Rotation 1 Answer
Quaternion rotation issue please help :'( 0 Answers