euleur angle

Hi all

I’m having a lot of trouble because of a misunderstanding.

In the doc I read the the HPR are the euler angles. Therefore I coded my whole program with those euler angles. I only had to use alpha and beta (the two rotation defined in here :, but I now need to use gamma (the third one). The problem is that HPR aren’t euler angles at all. The two first rotations are the same, but not the last one.

Is there a way to make Panda accept real euler angles ? And if there isn’t, do you know where I can find the formula to translate euler angles into tait-bryan ones ?

Thanks a lot.

This might help you out: … ematics%29

?? HPR should be euler angles, what else could they be?
You didn’t really say what your real problem with setHpr is, but I can imagine. Your problem is that your rotation won’t end up the way you intended.
I guess you are using setHpr like this:

model.setHpr(new_H, new_P, new_R)

try using it like this:

model.setHpr(model, new_H, new_P, new_R)

This will do the rotation in respect to the previous rotation.

Oh, remember that the HPR values must be degrees, not radians.

Looking into Tait-Bryan angles, they are simply Euler angles where rotations are relative to the current rotation, so Legion’s method should work correctly. The Tait-Bryan method looks to be most useful for someting like flying an airplane, but the default Panda3D method is most useful for things like a camera behind a walking character, which we usually want to keep upright.

Both rotation methods are “real” Euler angles.

First of all, thanks a lot Legion, it works.

I believe I did not explained well what I meant by “real euler angles”. At school, we leant to use euler angles for solid kynematics. These angles are the ones described in this page :

However the angles used in Panda are the Tait-bryan ones (who are also euler angles):

In our particular case, the two first rotation are the same in both cases. But the thiord one isn’t. In Panda, the third rotation is done turning around the new y axis, and in the euler angles I thought I was using, it is done turning around the new z axis.

Everything is solved with the solution provided bu Legion (thanks again), and you can just do that:

def rotateWithGeneralConvention(model, alpha, beta, gamma):
      model.setHpr(alpha, beta,0)
      model.setHpr(model, gamma, 0, 0)

PS: re-re-re-re-re-reading your posts, I think I may have not understood at all how the angles works in Panda (around which axes). My program works perfectly well now, but I may not be the only person with this kind of problem, and it could be good if somebody did a small article about these angles in the doc (I can do it if nobody wants to, but I would like to be sure of what I understood)