RandomPath.Construct() is always returning (0,0,0)

Not sure why this is happening, but every time I try to retrieve a RandomPath, it returns (0,0,0). Here’s the code:

int theGScoreToStopAt = 1;
//Create a path object
RandomPath path = RandomPath.Construct(this.transform.position, theGScoreToStopAt);

And the I try to check path.endPoint and it always comes up as (0,0,0).

Hi

How are you getting the (0,0,0), what exactly is (0,0,0)?

Sorry, I realized that my question didn’t make sense! I edited the question. (0,0,0) is the path.endPoint I receive from the construct call.

Hi

The Construct call is only a helper function to create a path object which can also handle pooling. It works much like a constructor.

To actually calculate the path you can use a Seeker or call the AstarPath object directly. See http://arongranberg.com/astar/docs/calling-pathfinding.php

1 Like