Paths

Topics: Developer Forum, Project Management Forum, User Forum
Sep 26, 2011 at 5:25 AM

The question I have on paths is the following:

When creating a path are the values you pass to the path relative to the body you pass in the PathManager or are they relative to the screen?  Also, are they in SimUnits or DisplayUnits?  I'm having trouble trying to set up a path for a body in my game.  I would like the body to follow a path after it has come in range of the player.

Sep 30, 2011 at 1:39 AM

Does anyone know or can explain how paths work?

Developer
Sep 30, 2011 at 3:19 AM

There is an example in the Testbed project.

Sep 30, 2011 at 4:44 PM

Yeah I've been looking at it.  However, my question is the values that are passed to the path and pathmanager are those coordinates relative to where the body is or relative to where they are on the screen.

For example, if you have a body that is in the middle of the screen and you connect it to a path and you pass the following values to the path:

new Vector(2,2);

new Vector(-2,2);

new Vector(-2,-2);

new Vector(2,-2);

Will the body follow a square like path from the position it is at when it starts or where those coordinates are on the screen?

Developer
Oct 1, 2011 at 4:26 AM

Well both actually.

When your distributing or moving a body along a path they are world coordinates.

When your converting the path to edges or a polygon then they are local coordinates.

Of course you can make the world coordinates into local by translating them...