Make an graph with motionpath

Well, I have a problem with how to implement a graph using motionpath. I need to connect multiple nodes through a network of routes (where each route would be a motionpath), and really do not know how to do it the best way.

Attached city image:

The idea is that each vehicle can make any combination and reach any node.

PD: Sorry for the english.

I haven’t used motionpath… but this is how I set up helpers for AI pathing.

Uh… lemme check… this is from the way back machine…

Look like a define all of the points of interest (POI) first.

Each one has a list of connecting POI’s and a path from the current to the connecting. You only need to define the waypoint path in a single direction… as you can reverse it.

I set up a cursive method for finding the fastest route from POI a (in my case: the POI the NPC is closest to) to POI x (in my case: the POI the player is closest to) and use the helper paths to traverse POI a to x.

You’ll also need to check to ensure that a and x are still valid while traversing the paths.

Also you’ll need to check for line-of-sight and setup a different method of pathing for that… but if you’re working with line-of-sight… it’s fairly easy.

I hope this is why you were asking and is somewhat helpful /shrug

Thanks a lot!, I could finally create the graph, even with reverse directions!.

Now I only need something, which I think is pretty simple but I have not managed to solve it.

When assigning a certain speed on a path, for example, “0.5f”, vehicles move at different velocities when one path is longer than another, even with the same speed.I want the speed is constant independent of the path length, because the change of motionpath of the vehicle is very notorious.

Thanks again!

@khedrak the javadoc will tell you there is a getLength methdod on the motionpath… use this to modify the speed,