Path not so precise

Hi,

So, i’m working on a game (obviously =), that takes place in a dynamically constructed building, with a front on view.

I got stairs in the building and trying to use the Recast graph. But the path im getting for stairs are not really so precise. The character walked fine on ordinary floor, but as soon as it was time to go up or down a stair, it was cutting corners, and wasn’t really attached to the stairs.

Here’s an image that shows the settings of the graph: image
Here’s a video that shows the character in action: video

To move, i started using itween but at first i thought it was something there that smoothed out the movevment, so i wrote the movement myself, going to each vector3 accurately, and then i discovered that i got those values from the returned path.

What am i doing wrong? The graph seems to sit nicely on the stairs,

Thankful for any insights!

Here’s an image that shows the graph in the stairs: image

Hi

First off, you probably want to use the funnel modifier to smooth out the path.
Secondly, I think you want to increase the character radius field in the recast graph settings to reduce the corner cutting.

Ah, i forgot to tell you, if i set the character radius field any higher, this happens: video

I added the funnel, and doesn’t really help anything, as far as i could tell.

Any other things i can try?

Happen to have a screenshot of the path when that happens?

Also. You might want to reduce your ‘max climb’ value slightly to avoid corner cutting on the stairs (but not too much as that will make the stairs to become disconnected).

Here’s a screenshot of the path:

Hmm… my post was flagged as spam by “multiple” community members. Did i miss anything in the rules?

Hi

How are you following the path?
Note that the y coordinates of a path are not necessarily accurate. Usually it is better to use e.g Physics.Raycast to figure out the y coordinate as collision information is usually a lot more detailed. However it seems you are using some smoothing which makes it worse.

Regarding the spam thing. No, you just happened to post a lot of links to the same domain, which triggered an automatic flag by the forum engine.

Howcome the y coordinates are not accurate in the returned path when the nodes outlined in the scene editor seems to be.
It seems that the smoothed out path that is returned from the pathfinder smoothes/skips a corner just when beginning to “spiraling” up the stairs.

Hi

The green lines you see in the editor is exactly the same path that is returned as the result in the vectorPath field.

Wow, such a noob mistake, it’s embarrasing! =)
I had tried to set values in the script which were overridden by the settings in the editor.

Problem solved. =)

But since i have you on the thread now, how can i, simply explained, set it up to having elevators and still use this graph type? Can i add node connections?

Ah. I see :slight_smile:

Elevators are a bit tricky. You can add links (see for example the second recast graph scene which has some climb links and some jump links). If you are using a custom movement script you will need to detect the links yourself by checking the type of the node.

1 Like

Thanks so much! I’ll take a look!

Thought i’d might as well continue my noob thread, since this is probably that type of mistake. =)

When doing an update of the graph (AstarPath.active.Scan();), the result is quite different than in editor even though the scene has not changed:

Any ideas?

Hm

That looks odd.
It should give you the same graph if it is based on the same world geometry.
Are you sure you are not changing the layers of anything during runtime?