How can I find the angle an object needs to turn towards a target from a rotated perspective?
I have been able to find similar questions to this but I still can't seem to answer this specific question. I have an object that will walk on 3D objects (slopes, walls, ceilings) and I would like to get the object to face its next waypoint on a path. I can get the object to rotate based on the normal of the mesh it's walking on using raycasts. What I can't seem to figure out is how to get the turning radius the object needs to turn to face it's next target (while standing on the angled mesh)? I am looking for a float between 0-360 to add to the objects y rotation as Euler with this piece of code:
transform.rotation = mNormal * Quaternion.Euler(0, yRot, 0);
Just to be clear, I am able to get the object to stand on angled meshes but I am not able to find out the relative angle (y rotation) the object needs to turn to face a target. If I manually assign yRot to 45f everything works fine. I just don't know how to find that angle. Thank you!
Your answer
Follow this Question
Related Questions
Rotating Camera around Player's X-axis while rotating Player around its Y-axis (using mouse input) 0 Answers
AngleAxis and MoveRotation not rotating around the object 0 Answers
Axis are not rotated as I would expect. 0 Answers
Clamp camera orbit rotation using RotateAround 2 Answers
Rotation Direction 2 Answers