Bullet trace rotation

I am very close to making it work. Currently my traces shoot out fine even when I rotate my ship. But the shots emerge from under the ship (local origo). I want to make it emerge from a point on the ship. How do I do this, my current code looks like this.







                Projectile pr = weapon._ammunition.getAProjectile(weapon._spaceShip.getPosrot().get_dof());
                pr.setLocalRotation(weapon._spaceShip.getPosrot().getNewRotationFromAxes());
           
                rootNode.attachChild(pr);



I suppose I have to translate the Projectile, but multiplied with the rotation?[/code]

sorry to bother you :smiley:



              Projectile pr = weapon._ammunition.getAProjectile(weapon._spaceShip.getPosrot().get_dof());
                Matrix3f rotMatrix = weapon._spaceShip.getPosrot().getNewRotationFromAxes();
               
                pr.setLocalRotation(rotMatrix);
                pr.setLocalTranslation((Vector3f)weapon._spaceShip.getPosrot().get_position().clone());
                pr.getLocalTranslation().addLocal(rotMatrix.mult(weapon._gunpoint,null));

Good, I was just about to sit down and work out the math. The prospect made my second head hurt. You’re a man who knows where his towel’s at… sorry, listening to the Hitch Hiker’s Guide to the Galaxy radio drama. :stuck_out_tongue: