hi, I’m trying to launch a rocket and have its ballistic trajectory shown and update in real time as the rocket accelerates.
the predict projectile path node works, but it’s debug visualization is poor for the purpose I need. it only add some green spheres and as they pile up they start consuming a lot of memory until the game freezes.
I want to add some sort of spline for viewing the path, but I’m not sure how to do it. I tried replicating the teleport arc from the VR template, but no success. any idea how do I do this?
How I have handled it on my projects is to add a spline component to my character class. I assume since you are following the example you are planning on casting to the navigation plane. If that is the case then I first ensure that the prediction hits as well as that the location can be mapped to the navigation plane. If that is the case then I can begin constructing the spline points.
One of the output pins on the PredictProjectilePath node is “OutPathPositions” pin. this has all of the points that your projectile would have gone through. The first thing I do it to step through each of those points and add a new spline point to the teleport spline component with the given point’s location. After that is complete, I will have a spline that should correctly be interpolating through each of the points that was predicted. All that’s left now is to give them a mesh.
For this I’m going to once again use a for loop. But this time instead of looping through each of the spline points I will loop through all but that last one (total number of points - 2 is the same as last index -1). For each cycle of the loop I will begin by create a new spline mesh component with a default transform. It doesn’t matter that this is in the wrong location since I will be changing it’s starting and ending points anyway using the set start and end. After I create the component I will get the location and tangent of BOTH the current index and the next index (that’s why I only go to 1 before the last index) and pass all of that data into the correct fields of the set start and end node.