First of all take a quick look at this :


So this is to give a idea of what I mean by following a path, basicly I am trying to understand how something like that would work out, I don't mean the sonic like motion, what I want is how do I constraint the movement to predefined path. But still being able to Jump.

The trouble I am having is how does it behave when falling from the loop? how does it know in the Spline/Path it should align to?

What I want is a some sort or explanation on how something like that would be implemented, the motion is not my concern.


1 Answer 1


You don't constrain the vertical or lateral movement. The path line is only for controlling the depth and direction of the player character.

You can see from the video the little white line that's attached to the green path. That white line shows where the character is "attached". The white line is just the closest point on the line to the player. Imagine you can draw a perpendicular line to the path that always faces 'forward'. This line defines the 'forward' and 'backward' for the character as well. We'll call that the forward vector, and that's the most important thing we get from the guide path. The forward vector tells us how to move the character in each update iteration. If your character has forward velocity heading into a corner, the forward vector is going to steer your character around that corner.

Basically, you need to find the closest point on the guide path, and use the forward vector found from that point to steer the character. Most of the time that'll just be regular old forward. However, that forward vector will also steer you around 3D corners and it'll rotate the character so they can move through the loops.

  • \$\begingroup\$ So I guess my problem is figuring out the closest point, and make all my character movement on the forward axis \$\endgroup\$
    – Morphex
    Commented Dec 14, 2014 at 19:00
  • \$\begingroup\$ That would be a new question. \$\endgroup\$
    – House
    Commented Dec 14, 2014 at 19:01
  • \$\begingroup\$ Yeah, but you did help me quite a bit :D, you made me "think" this in another way. \$\endgroup\$
    – Morphex
    Commented Dec 14, 2014 at 20:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .