rotation

Hi,

I can do what I’m planning in other ways, but it would be simple if I could rotate just the axis or the model independently, does anyone know how I can do this kind of transformation?

thank you!

by independant do you mean setting only ONE axis? or do you want to set the rotation independant from it’s current rotation?
if you just want to set one rotation you can do

yournode.setH(yourvalue)

if you want to rotate independantly from it’s own transform then you can rotate the node relative to another node (for example a dummynode or render)

panda’s node system can perform a great deal of tranformation magic for you:) try to play with it for a bit.

I didn’t try your code Thomas, just to explain,

for instance, sometimes I want the y axis to be pointed in one direction, to the right, and sometimes I want it to be pointed in another direction, to the left, but the model must stay in it’s own transform, for instance, always facing the camera.

If you don’t want the model to move visually, then what do you expect to happen when you move the y axis? Some other object should move instead? It sounds like what you want is just to move a different node than the one that actually contains your model.

David

that’s it drwr!

Another object should move relative to the y axis of this one that I don’t want to move visually. I just want to be sure that doesn’t exist a function for this task. But can be accomplished in other way. =)

Perhaps you mean:

Another_object.setY(this_one, 123)

?

Also, don’t overlook simply parenting a node to your model, and rotating that node.

David

ok =)

Creating a node and rotating it works perfectly, that’s the way.

now I can use:

myObject_parentNode.setHpr(value) # rotates just the  parent node
Another_object.setY(myObject_parentNode, 123)

thank you.

I use this trick in my game. Since my vehicles are hierarchical objects, I only rotate the child PandaModel node to make my object tilt and sway, but I only modify the heading of its parent node.

Simplifies some math too, because I can always expect my vehicles to be conceptually level on the X/Y plane. (When the vehicle is “diving” or “climbing” it is only a visual effect. Perfectly acceptable for vehicles existing on what is effectively 2D terrain.)

PandaNodes are kind of like crack candy. I found that I tend to use them to store all kinds of information, such as rotations and whatnot. I am not sure if this is intended, but it doesn’t seem to harm my game. Panda3d is pretty smart when it comes to traversing nodes for rendering/collision, and it will cache/compose rotations so that it doesn’t matter too much if you spread things around.