fire weapon animation

Hi, I’m having problems with the placement on my fire weapon animation. I have bound the fire weapon to the space bar key, and it fires on command, but the firing happens in a different place each time. I think it’s because I’ve set it to fire based on xyz coordinates, and when I turn around, it still thinks the front of my character is facing the same direction, so the fire animation happens behind him. Here’s the code I have for the fire() function.

def fire(self):
pos = self.ralph.getPos()
#print “firing projectile at”, pos

    projectile = loader.loadModel("models/projectile1")
    projectile.setPos(self.ralph, -5, 1, 2)

Any ideas on how to make the fire animation always be in the same place in relation to the character and the direction he’s facing?

Panda works on a strong parent-child relation basis. Every child inherits the properties of its parent(s). This means that if you make your projectile a child of ralph, it will automatically inherits ralphs position and orientation:

instead of