confused about torque in bullet in panda3d

Hi. I’m slowly learning more and more panda3d. and loving it

one thing I am confused about is how to make force push an object in the relative direction.

For example, I have a shuttle in space. If I rotate the ship and then apply force the ship does not move in the direction its facing but rather on the x axis.

It’s a gap in knowledge but one I do not know how to fix, have searched the forums but no able to find the answer.

on a related note, if this is kind of question thats. been asked a thousand times, it’d be worthy of a sticky faq thread perhaps. where popular questions and answers could be easily found.


Ps, what version bullet is included in panda3d. 1.80

Here’s what I do:

force = Vec3(0, 1, 0) # Forward
vector = ship.getParent().getRelativeVector(ship, force)

thanks for the answer rbd! I’ll try it out.

is the ship object you are referring to a mesh or node or a nested bullet node NODENAME1.node()?

EDIT - i’m trying this in my input event ahndeler section’

        vector = self.rocket1.node().getParent().getRelativeVector(self.rocket1.node(), force)


but have error AttributeError: ‘libpandabullet.BulletRigidBodyNode’ object has no attribute ‘getRelativeVector’

agian my lack of knowledge

edit 2 solved it.

    def processInput(self,dt):
        force = Vec3(0, 0, 0) # Forward
        torque = Vec3(0,0,0)

        if inputState.isSet('forward'):

        if inputState.isSet('back'):

        if inputState.isSet('right'):

        if inputState.isSet('left'):

        if inputState.isSet('up'):

        if inputState.isSet('down'):

        if inputState.isSet('shoot'):
            print ("camera pos is", self.camX, self.camY , self.camZ)

        if inputState.isSet('movehere'):
            moveto = self.getMouseXY()
            print ("mouse is at",moveto)
            spaceS = self.make_space_station(moveto[0],moveto[1],0)

        force = render.getRelativeVector(self.rocket1, force)

based on your exampe, which i used in google and found this awesome post by ennox. helped a ton. … fc241d7aaa

getRelativeVector should be referring to the NodePath, in your case self.rocket1. The force is applied to the BulletRigidBodyNode, in your case self.rocket1.node().