Help, with projectile motion in game

I’m making a game with a digger, at the moment I’ve added a fire mechanism which shoots little projectile, this was just a test to see if I could code it. It works however I do not understand how to adjust for the vehicle movement. Ie if the vehicle is moving is moving forward, how can I make the bullets account for the change in speed.

thanks guys.

1 Like

Just add the tank speed to the bullet speed (set the initial speed of the bullet to that of the tank)

1 Like

Thats what I initially thought but however I try it it doesn’t seem to work, and simply sends the vehicle speeds past the projectiles.

The only solution I found that worked was to increase the projectile acceleration.

Sketch updated

Fixed, completely forgot, that the x component of the tank velocity was calculated using its y velocity.

Code rectified, with your suggestion Chrisir, thanks.