# How do I get an object to follow a curved path.

0 favourites
• 7 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
• Hi,

I am working on a form of path-finding for my game. On a move command, it will calculate a path for the player using "nodes".

What i'm trying to work out is this: my player moves to node 1, and then cuts at a sharp angle to node 2 (following the red path here: http://i.imgur.com/FOgFuOv.png), which looks a bit odd. I am trying to gradually curve the player around objects (using the nodes as a guide) so that the player follows something more like the green path shown in the image, instead.

Can anyone think of a formula/approach to get the player to curve it's position gradually as it approaches a node?

(Using: player.x, player.y, node1.x, node1.y, node2.x, node2.y)

I think the Sine behavior might be of use, but this one's got me stumped.

• There's these ideas:

I'll need to check later to update my links.

The formulas are usually a bit too lengthy to remember.

• Thanks for the links guys! I came across this page: https://www.particleincell.com/2012/bezier-splines/ and it looks similar to what I need. That said it isn't perfect.

In any case, I think the math involved is beyond me. Even if I were to implement it following the bezier spline method, you'll notice how there is an "unnecessary" curve between the first two nodes: http://i.imgur.com/fULycxI.png

I don't need my object to follow the path perfectly, but rather simply curve around the edges (when closer to the nodes) with the goal of just making the movement smoother, do you know of a simpler way to implement something that can achieve this?

• You could just use the "rotate to angle" action to gradually turn to a object. It will be smooth but not symmetrical.

• Colludium made a very nice behavior:

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• rexrainbow Has a Spline approach.

• 7 posts