How to attach a pawn to a Spline Blueprint
Yesterday saw this tutorial that shows how to create a road using the construct script.
That is very good and works perfectly.
Only I want to implement other features to it and I am in doubt about how to do this. And I need help.
I need these options, because I have to do a roller coaster, tried using a plugin, but it only works in older versions of UE4 (Version 4.6.1).
And I want to reproduce this effect, but using the Gear VR.
asked Jun 06 '16 at 05:41 PM in Blueprint Scripting
Attaching to a Spline involves setting the location of your pawn to a specific location along the spline (bear with me). To get a location on a spline you can use one of two methods: Distance or Time.
Time of a spline is 0 to 1 from the start to the end. So .5 time on a spline is halfway.
Distance is the actual length of the spline in units.
So if you wanted to move down a spline then every tick you could set yourself some distance or time down the spline.
This example increments a distance tracking float based on a speed float. At the end I find out where in the world that distance down the spline is and i use it to set my actor/pawns location:
You could use Time if you want to always go from beginning to end relatively.
On top of all of this you can get the tangent at any time/distance to perhaps change your acceleration/velocity so you move slower up hill and speed up going down hill.
None of this takes advantage of the built in physics systems but would make an easy to handle rollercoaster.
answered Jun 07 '16 at 05:45 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here