Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to attach a pawn to a Spline Blueprint

Hi guys

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.

Features list:

  • Ability to attach the pawn (player) to follow the spline

  • Being able to follow the path, but the possibility to freely look around.

  • Possibility of applying gravity in pawn

  • Ability to change the speed that the pawn makes its way

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.


Product Version: UE 4.12
more ▼

asked Jun 06 '16 at 05:41 PM in Blueprint Scripting

avatar image

50 9 19 25

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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:

alt text

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.

capture.png (164.9 kB)
more ▼

answered Jun 07 '16 at 05:45 PM

avatar image

2.6k 98 16 97

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question