x

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 follow a spline.

I'm currently developing a game that has elements similar to infinite runners or the 3D Sonic games. I have the track, the movement and items etc.

The game is fully functional and almost ready to ship, but I want to experiment with a new idea to make the levels feel more interesting. SO I played around with spline components so I can have the track warp and turn. I have achieved this with a construction script and setting the distance between spline points etc - but the real issues are as follows :

The character runs automatically down the X axis, which isn't always in line with the track.

The items that are generated also no longer follow the track.

What I'm trying to achieve :

  • I want the character to follow the spline rather than just the X axis, but still allow the player to move left and right (Y axis) and jump.

  • Allow the generated pickups to adhere to the spline.

I'd really appreciate help with this.

Product Version: Not Selected
Tags:
more ▼

asked Dec 14 '14 at 02:46 PM in Blueprint Scripting

avatar image

Kenomica
434 40 40 46

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

1 answer: sort voted first

Hi Kenomica,

Yes the Spline is excellent for creating rails. You have a few options at your disposal. You can get the Location, Rotation, and Direction along the spline using either Time or Distance. What you end up having to do on your end to utilize this is creating a variable which can hold your distance or time. Next you increment this value up in order to progress on the spline. The results are outputted by these nodes. You can also get tangents for more direction information. alt text

Now to setup what you want with these tools you must create

alt text

This was all made very loosely and should be taken as-is. I believe this should work. I've done it a few times, so I feel safe saying this should work. If you would like me to help you with your setup directly I can do that.

step3_spline.png (332.3 kB)
step3_spline.png (333.9 kB)
more ▼

answered Dec 14 '14 at 04:47 PM

avatar image

PeterLNewton
2.1k 75 37 111

avatar image Kenomica Dec 14 '14 at 09:07 PM

Thanks for the detailed reply! it's a little complex, since I've never attempted something like this.

I'm glad my post made sense.

The main issue is that the movement system is controlled (currently) by using Add Input & uses the character's movement speed, since it can be changed using things such as the difficulty level, boosts and obstacles which launch the player back as well as obstacles which slow the player down.

I obviously need to keep that as it's an integral part of the system. There is also a character chasing the player which uses the same system.

Also, an even larger issue is making the spawned items adhere to the track.

I will certainly give this a go and experiment further. Thank you very much.

avatar image PeterLNewton Dec 18 '14 at 04:32 AM

No problem at all Kenomica.

The system you currently have would work within this setup. You would just have to feed vector your characters input like how I have "Take Character / Actor & Apply Input".

The way I build tracks at this point is in this order. Either a spline is placed or generated. Then I have a script which will place tracks on the spline. Next I have the obstacles, and etc spawn on the track on construction of that track. This way makes it easier to understand for me when I locally offset obstacles and etc to the track.

But I would love to see what you finally decide to on because I honestly haven't found a way that has stole my heart. ;D

avatar image Kenomica Feb 03 '15 at 06:00 PM

Apologies for the late reply - I have sadly decided to abandon using spline components, since the number of tracks cause a performance impact - So I've decided to stick with my straight tracks for now as I can use instances.

Not as nice to look at, but performs much better.

Thanks for tour help, all the same. :)

(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