How to get heading, pitch and roll from the two points

If you have the two points, you can compute the vector direction by subtracting one from the other.

Here’s a function you can use to get a rotation matrix from the origin and the vector.

Lastly, you can use Quaternion.fromRotationMatrix to get a quaternion, and HeadingPitchRoll.fromQuaternion to get the HPR object.

Hello Gabby,

I'm trying to follow your approach to determine the orientation between two points but I don't get correct results. I think the function you referring to is `Cesium.Transform.rotationMatrixFromPositionVelocity`?

I created a Sandcastle example with my code (the blue cone should point to the green 'target' point):

Do you know what I did wrong?



Nevermind, I got it working:

(my previous example applied a wrong transform for the orientation)

This is great! Thanks for posting your solution. I imagine this will be useful to a lot of others as well.

This is a great work of two points and a cone orientation drawing. Thanks for sharing your solution!

hello, can you send the code i got the same problem. thank you very much

here‘s the code (for some reason the original link doesn’t work anymore):

thank you very much!