Constrain character to series of intersecting paths?

For the purposes of my project, it’s helpful to think about the world maps in old-school Super Mario games, such as this one. I am trying to make a 3D game wherein the character’s movement is constrained to paths not unlike the above image—a series of connected “nodes.” These lines run in any 3D direction (so point A would be at [0, 2, 3] whereas point B would be at [4,1,2] for example), and will often intersect so the player can change paths. In terms of the control scheme, think Diablo-style point-and-click, only restrained to specific line-based paths.

It looks like RigidBody can constrain movement along basic axes, but how can I constrain my RigidBody to these custom lines I have that move throughout all three? Bonus points if there’s an easy way to dynamically generate those paths from geometry intersections in the level.

The answer is yes to all of those questions.

If you want a really easy method, I would suggest using iTween. It provides exactly what you want for an affordable price.

If your willing to do some coding, then you can do some really basic node navigation. Each point represents a node. And each node keeps track of the nodes near it. As long as the player is controlling the character, you don’t really have to do much pathfinding which is very very good for you.

When the player is at a node, they have the ability to choose the next node that they go to (Either by arrow keys or mouse clicks). Then the player starts moving towards the next destination. Here’s what I mean in a quick algorithm.

 foreach(node in set) {
       if distance (player, node) < someSmallDist //Account for a little inaccuracy.
                currentNode = node;
                break "foreach" loop;

 }
 if(currentNode != null) {
       targetNode = NewNodeFromInput()
       moveDirection = targetNode - PlayerPosition
       Player.Move(moveDirection.normalized * speed)
}
else {
       Player.Move(moveDirection.normalized * speed * Input);
}

That’s pretty simple to be honest. You can do far more elaborate pathfinding routines, its just all a matter of what you are able to do.

There are also plenty of AI routines on the Asset store if you want to look there. Most of them are relatively inexpensive so it might be what you want if you can’t program.