It is probably something simple. I looked over here in the forum and found some things that are similar to what I’m trying to do, but I wasn’t able to do it, even with those topics about rotating Roaming Ralf … So I’m looking for help!
I have a nodePath that is my Pacman. I want to rotate it around itself.
IF the pacman is like that
O—>
I want his eyes to be looking to the right. And if the person wants to move it to the left, I want it to rotate 180 degrees and now be like that
<----O
Because of that, I need the axis of the rotation to be like the Z axis, but with the origin point in the center of my sphere (the pacman)
How can I do it? I’m able to rotate with Hpr, but it rotates and changes its position. I just want to rotate it, without moving.
Tks a lot just for reading. You are hellping me a lot!!!
yes, it will. alternatively you can set a relative center point as first argument in most (or even all) transform functions. like nodepath.setH(anothernode, 10)
If I understood it right, this new node will be like the center point. But I don’t know how can I put it in the right position (in the center of the sphere).
That’s not quite right. Setting a rotation relative to another node doesn’t indicate an alternate center point; what it does is specify the rotation in the other node’s coordinate space, which is really something completely different.
The way to rotate a model about a specific point is to create the model in the first place with that point at (0, 0, 0), as ynjh_jo said. If you didn’t create the model and you don’t have the ability to modify it, then you can achieve the same thing by using nested nodes, something like this:
Tks a lot for your response. Although I’m trying to set the center through the 3D-modeler (in my case, Maya), this can be very helpful in case I fail with Maya!
@Everybody
I asked Maya to show my center pivot, and it was set exactly in the middle of my sphere. But, when I import to Panda3D, the center point is a different one, much closer to the external circumference.
Does anybody know what I’m doing wrong?
Tks again!
It’s not Maya’s “center pivot” that matters, but the model’s origin: the (0, 0, 0) point within your model. To change the origin, you can apply a translation to the model, then freeze transforms.
David, I started fixing it and it is working. Tks again! In case I have another trouble with this rotation that I can’t solve by myself, I’ll came back to this thread for sure!