Download

How do predict projectile path in real time?

So I have a ship moving very fast, and I want to show it’s predicted projectile path if it were to cut the engines and become a projectile, but it has to update in real time as my speed increases and direction changes. how do I do so?

Do it with predict projectile path :slight_smile:

yes that’s what I’m trying to do, I just don’t know how. this node basically show spheres at a fixed position, while I want something like a spline that updates in real time, and I don’t know where to start.

another thing that I wanted was to show the flight path behind the ship, the past trajectory that my ship flew through

the predict projectile path works, but I set the projectile radius to 10, sim frequency to 30 and max sim time to 10 since the path gets larger and larger as the ship rises, and the screen basically freezes because it’s displaying a lot of projectiles. these green spheres thing that the node shows as debug.

I need to show this path in some way that I can view it from far away and it’s still visible, and also that won’t freeze my screen. I thought connecting splines from one projectile point to the other might do the trick, and I can decrease the number of projectile steps, but I don’t know how, I tried the teleport gizmo of the vr template but it didn’t port very well as there was a lot of stuff there. also not sure how to keep the spline the same size relative to the screen, regardless of the observator’s distance

If you’re fine with using something like arrow marks or dotted lines instead of a continuous line to display the path, I’d suggest using Instanced Static Meshes instead of splines. It will hold up a lot better than splines in terms of performance when there are a lot of path points.

As for your past trajectory, you can use a Timer that regularly keeps checking the distance traversed and stores path points in an array. Every time, it calculates that you have traversed a certain amount of units (let’s say 100m) from the previous path point, you can store the new location to the array.

I’m fine with using spheres even, but I don’t know how to do so. I also need to be able to see these objects from a great distance in case I zoom out a good amount to see the whole path, so kinda need to keep their size and possibly separation constant relative to the screen

Alright, since you want distance-based scaling, using spline meshes will be easier to implement. I’m assuming that you’re using some kind of top-down view for your game. In that case, you can store the value of default spring arm length for your camera at the start of the game.

Then every time your camera zooms in or out, divide the new spring arm target length with the default value and you will get the scale multiplier for your path mesh.

Now, whenever you add a spline mesh component to display the path, use the Set Start Scale & Set End Scale nodes to update the scale using the scale multiplier value calculated above. I believe that should do the trick.

https://www.youtube.com/watch?v=6OkhjWUIUf0