I am a little new to Panda3D and I need some help with rotation.
I have a sphere and a ship. I am keeping track of the ship’s position via latitude (up/down), longitude (left/right), and heading (rotation of the ship) values in degrees. I have a function to position the model at the correct xyz coordinates when given lat and lon, but I also need to be able to rotate the model so it is always tangent to the surface and pointed the right way. I cannot figure out the math for the life of me.
I have been able to get the ship to be tangent no matter the position by setting:
h = longitude
p = -lat + 90
r = 0
but it is always facing up (bow straight north). As soon as I try to rotate it (so that it faces bow east for example), everything goes wrong. P and R both rotate the model about the vertical axis. Can someone explain whether the hpr values are aboslute, or relative, or how they work? They seem to act totally differently depending on what values for R or P I input.