setHpr/rotation question

I have some code that looks like this:

ctr = 0

def update(task):

   global ctr
   global world

   world.element.head2.setHpr(ctr, 0, 0)

   if ctr == 360:

     ctr = 0

   ctr = ctr + 1

   return task.cont

And when I run the code, head2 rotates. Although I want it to rotate around its center, and it rotates around its edge. Is there a method to rotate a model around its origin? If so, how?

Thanks,

DangerOnTheRanger

by default it does rotate around it’s own center (the pivot point of the model).
for a sollution, you either have to move the model so it’s actual geometry center matches it’s pivot point. our you add a dummy-node and reparent the model to that node, move it in place, and rotate the dummy.

So that means I must have changed an option?
Oh, and does calling setScale change the pivot point?

I could supply a video of how it looks when it rotates, if that would help.

(I apologize for all the questions, but I’m still learning…) :blush:

scaling does not change the pivot point.

have a look at the solar-system sample which comes with panda. it shows you how to rotate nodes around something else than their own center.

(alternatively fix up your head in your 3d-editor , like blender or maya )

Great, will do!

Thanks again! :smiley: