Hpr Ranges

Hey everyone - simple question, just feel like I’m missing some fundamental piece of knowledge.

In experimenting w/ code that rotates the camera around an object ( using up/down arrow for pitch, left/right for roll ), I do something similar to:

yaw, pitch, roll = rot.getHpr()

increment pitch and roll by some amount

rot.setHpr(yaw, pitch, roll)

And, I get good results for roll - I can increment it by 1 with no bounds, and Panda3D will correctly set the angle to what is intended within it’s accepted range. ( For instance, if I increment the roll, which is at 179 by 2, it will become -179 ). Strangely enough, however, I can’t do this for pitch. Further more, unlike yaw and roll, pitch seems to be limited to a -90 to 90 range, which is very confusing to me.

What am I missing? All I want to do is steadily rotate the camera around some point on any combination of angle components, but I’m getting stymied by this.

if you are up 95 degrees isn’t it same as up 85 but backwards -180 and inverted rotation?

If you want it just to rotate around like this i recommend using matrix and rotational matrix’s.

The better way to steadily rotate about some axis is something like this:

rot.setHpr(rot, 0, 1, 0)

which means to rotate 1 degree of pitch higher than the previous rot’s angle. This will properly handle what happens when pitch goes above 90 (which does, indeed, mean an inverted roll).

Euler angles are weird. You can’t just operate on them using simple addition in many cases.

David