Need help with high speed projectiles from moving ship

I have a static mesh ship that moves at high velocity. I am spawning a projectile from an arrow that is welded to the meshes gun. The issue I am having is that I can’t get the projectile to properly appear as if it’s spawning from the gun at high speeds. The projectile appears to spawn in front of the ship and when I turn it appears as if it’s far away from the ship (above or below depending on how the ship is turning). I tried to have variable speed that depend on how fast the ship is moving but frankly I’m lost. Any advice on how to get the projectile to properly spawn from the gun while turning at high speed? I am using a mesh for the projectile, tried using a particle system but it doesn’t help either.

I’ve seen this happen on a very similar situation on my own flying game. One option is to have a cosmetic projectile like a particle system, and the actual impact/damage to be calculated using a line trace. I also noticed that this issue is always related to the frame rate as the projectile appears on different places depending on the frame rate, so another option you could try is to use an “add world offset” that multiplies the speed by the delta time and removing the projectile component completely.

Hope this makes sense.

This is kind of a left field suggestion, but what if you have the projectile already spawned, moving with the same velocity as the ship, and then simply simply set it to visible and apply the extra velocity that you wish it to have? I am just guessing that perhaps there is some kind of lag that becomes noticeable at high speeds.

I don’t really want to use line tracing as the pojectiles need to be seen during the game flying through space (large space battle with many AI ships firing many visible projectiles).


-cylinder mesh with colored material
-projectile component
-construction script gets ship velocity and adds that to an initial speed of 450,000 cm/s and there is a static max speed of 2,000,000 cm/s

The construction script works better than having a static initial speed. The projectiles look ok when flying in a straight line at static speed but when accelerating or turning the projectiles appear to spawn in front of the ship (when accelerating) or above/below (when pitching). The ships guns are on the left and right of the ship behind the cockpit so the projectiles (essentially look like lasers) should appear to be firing from the left and right but when the ship is changing its vectors this does not happen.

If the projectiles are appearing in front when accelerating, it sounds like the rendering of the ship may be off by a frame. e.g ship is rendered at the position prior to the one you are using to calculate when launching the projectile.

You could experiment with changing the tick ordering of the ship (see TickGroups)

To prove the hypothesis - you could store the prior position of the ship from the last frame and launch the projectile from there

It sounds like you are simply spawning the projectile from the ship without accounting for the ship’s velocity.
Actually after reading your later replies it seems you are attempting this but your implementation may be off, I won’t edit the rest of the post as it is still relevant. OnConstruct is probably too early**

In the above Mythbusters video you can see when firing a cannon backwards with a muzzle velocity of 60 MPH, while driving forward at 60 MPH, the net velocity of the projectile is zero. This is due to the fact that the velocity of the car is added to the projectile 60 + -60 = 0

What this means to you

When spawning your projectile you must capture your ships velocity and add it to your projectiles muzzle velocity(In local space, not world space). See my tutorial below to point yourself(and your projectiles) in the right direction.

Note. This tutorial is from a first person perspective so Get Control Rotation is used to Unrotate the players velocity vector from World Space to Local space, you will probably need to use the ships rotation.