Shoot bullet from object to player

Hi,



I want my spaceship shoot bullets to the player…

the target is my camera node

Anyway this doesn't work :frowning:


            Vector3f direction = new Vector3f (target.getWorldTranslation());
            bullet.addController(new BulletMover(target, bullet, direction, speed, lifeTime));



How do i get the right vector pointing from the ship to the camera node?
damn math ;(

thx

subtract the current position from the target position to get the direction

thx irissor… :smiley:



guess I should recapitulate some math (especially vectors :wink:

it's too long ago ;/



            bullet.addController(new BulletMover(target, bullet, target
                    .getWorldTranslation().subtract(
                            fighter.getWorldTranslation()), speed, lifeTime));