rotational weirdness

I’m trying to get a joint to rotate using a joystick input. I can get it to translate with no problem, and I know I’m getting good numbers for the joystick, but when I try to tie it to the HPR values, it rotates around the same axis for H and R. Why could this be?

Is it possible your P = 90 or -90? At this extreme pitch angle, H and R are the same thing.

How do P, H, and R relate to X,Y, and Z rotational values or do they? I may be misunderstanding how these function. Is there some sort of documentation that would explain this?



I guess I should add that the jostick values got from 1- to 1 and I’m multiplying that result by 50, so I’m not hitting a ±90 issue.

You can think of H as rotation around the Z (up) axis, P as rotation around the X axis, and R as rotation around the Y (forward) axis. But it’s also useful to visualize H and P as longitude and latitude, respectively, and R as rotation in place. Or, H and P are the azimuth and altitude of a telescope, and R is rotating the lens itself.

As P approaches 90, H and R become more similar, just as when your latitude gets higher, a movement east-west becomes more like a turning in place, until you reach the north pole where the two movements are exactly the same.

Try isolating the H, P, R angles. Just set one of them at a time, and ensure the other two are 0. This will help you visualize exactly what each angle means. When you are setting more than one of them at once, it is easy to get confused.


finally got it to work. Had to keep setting P to 0…seemed to always want to be 90 and that was causing the problem. Possibly some sort of rotational info from the axis. If I haven’t frozen transforms so that there is rotational data on the axes, I’m guessing this could mess things up. At least it works now, so that’s on less thing I have to worry about.

thanks for all the help


Found out that really didn’t fix anything…optical illusion on my part by using a solid color on part of a sphere, so no way to tell what was moving where. The problem I have is that it is setting p=90 when I load in the model. How is Panda deciding what the rotations are on the axes? Is it creating its own local axis orientation? If so, is there a way to force this to make HPR=0,0,0? When I set P to 0, it twists my entire model, so then I’d have to add the 90 back in, but this messes up my H&R rotations. Also, what is the rotation order?



it all depends which direction the model is facing when it is made (in maya or max). I know that in maya the “front” is really the “back” in panda. (you can prove this by using the model.lookAt(camera) function and watching the model turn his back to the camera).

So you need to know which way your model is facing when constructed before you can hope to know which way he is facing after a rotation

The 90-degree rotation might be due to a coordinate system shift, from Y-up to Z-up. Depending on what kind of model you have, you might be able to remove it when you load your model by calling:


The above call applies transforms to vertices, where possible, and removes them from the scene graph. It is akin to “freeze transforms” in Maya. But it cannot be applied to animated characters, which require their transforms to remain the way they are recorded in their animations.

Another simple answer is just to create an intervening node that has no rotation on it, and parent your model to that node. Then you can set whatever H,P,R you like on that node without worries.


I’m using an animated character because I’m then manipulating the joints in order to move geometry. So if I have an arm, I have a shoulder, upper arm, lower arm, and hand joints. I think that I read that if you want to expose joints and rotate them that you have to have an animation of some type, so I can’t just manipulate models for this.

I want the lower arm to only rotate about 1 axis. This is the X axis in Maya and would also be the X axis in Z up space just offset 180 degrees. When I inserted the joint higher in the hierarchy, I noticed it gave HPR values of -90,0,-180 which makes the Y up to Z up conversion (would cause the front equals back problem with the panda that was mentioned earlier). I was then able to get the P value to rotate the way I wanted it. Thanks for the help.