Rotating a model

How would i go about rotating this model? (Not rotating a camera around it)

thomson = self.loader.loadModel("models/thomson/thomson.x")
thomson.reparentTo(self.render)
thomson.setScale(4.0, 4.0, 4.0)
thomson.setPos(0, 0, 3)

Excuse me for my noobishness!

thomson.setHpr(0,0,0)   #or whatever you want to rotate to

H = heading
p = pitch
r = roll

I get this error:
“thomson.setHpr(0,0,0)
IndentationError: unexpected indent”

code so far:

thomson = self.loader.loadModel("models/thomson/thomson.x")
thomson.reparentTo(self.render)
thomson.setScale(4.0, 4.0, 4.0)
thomson.setPos(0, 0, 3)
thomson.setHpr(0,0,0) # ERROR

Are you sure that the code is

thomson = self.loader.loadModel("models/thomson/thomson.x")
thomson.reparentTo(self.render)
thomson.setScale(4.0, 4.0, 4.0)
thomson.setPos(0, 0, 3)
thomson.setHpr(0,0,0) 

and not something like this:

   thomson = self.loader.loadModel("models/thomson/thomson.x")
   thomson.reparentTo(self.render)
   thomson.setScale(4.0, 4.0, 4.0)
   thomson.setPos(0, 0, 3)
thomson.setHpr(0,0,0) # ERROR 

even just one space difference will give that error. I think that it is just an error with syntax.

thomson = self.loader.loadModel("models/thomson/thomson.x")
thomson.reparentTo(self.render)
thomson.setScale(4.0, 4.0, 4.0)
thomson.setPos(0, 0, 3)
thomson.setHpr(0,0,0)

this is how it looks right now, giving the same error.

EDIT: Fixed! So i can’t use tab instead of space when making the code tidy.

You can, just beware of any extra or lacking spaces.

You can’t mix different indentation styles per document, like: Tab vs. 4 spaces vs. 2 spaces. If you do that Python can’t tell what you’re up to.

Also in the future try to formulate your problem more precise. Using setHpr like bigfoot suggested will make your model head in a certain direction immediately, without a transition.

If you want your model to rotate over time, you have to use an interval or task. Both “rotate” your model a little every frame by using setHpr every frame … so it looks like as if it is rotating. Study the manual on intervals and tasks.

An interval rotation might look like:

rotation_interval = yourObject.hprInterval(240,Vec3(220,0,0))
rotation_interval.loop()