StartPointSnapping prepends agent position when exactness is set to Original

Hi @aron_granberg,
I have noticed something that I am unable to understand.
It seems that if the seeker attached to agent has set start point snapping to original it then prepends the agent position to the path. Does that happen by design? If so how to calculate path from the given points without any alterations when using seeker that is attached to the agent?

On this screenshot I am calculating path between start and end using a seeker attached to FakeAgent. When the start point snapping is set to the Closest On Node Surface it behaves properly, but when it is set to Original it starts from the Agent’s position - which for me isn’t “original” as it differs from the start argument.

I am using 4.3.58 pro version if that matters.
Thanks!

Hi

The modifier will set it to path.originalStartPoint. I’m not sure how you construct your path, but that’s the relevant field.

If you want to calculate a path which is not related to any specific agent, it might be better to use the AstarPath component directly:

var path = ABPath.Construct(..., OnPathComplete);
AstarPath.StartPath(path);

void OnPathComplete(Path p) {
    // Optionally, if you want modifiers
    seeker.PostProcess(p);
}

I am simply calling seeker.StartPath(start, destination) in this example.

I know that I can use AstarPath directly, but I want to run the modifiers that are attached to the agent so it seems a bit daunting to call them individually. When I run all of them it will prepend again, so I will need to filter them out first. Is it the way it supposed to work?

Hi

Hmm, I found a case where this could happen. Do you have an AILerp script attached by any chance?

You can call seeker.PostProcess(path) to apply all modifiers attached to that Seeker on the path.

yes, I do have it indeed :slight_smile:

About calling the seeker.PostProcess(path) - I am aware of that, but currently it will modify the starting point as in the first post in this topic due to the Start/End modifier be also called. I have to call the postprocessors individually and it is a bit tedious.

Ah!

So the AILerp script has this snippet of code:

// Tell the StartEndModifier to ask for our exact position when post processing the path This
// is important if we are using prediction and requesting a path from some point slightly ahead
// of us since then the start point in the path request may be far from our position when the
// path has been calculated. This is also good because if a long path is requested, it may take
// a few frames for it to be calculated so we could have moved some distance during that time
seeker.startEndModifier.adjustStartPoint = () => simulatedPosition;

In retrospect, that is not great design. But at least now we know why this happens and how to work around it.