Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct Behaviour in PathCorridor.MoveOverOffMeshConnection? #54

Closed
70fu opened this issue Feb 7, 2016 · 1 comment
Closed

Correct Behaviour in PathCorridor.MoveOverOffMeshConnection? #54

70fu opened this issue Feb 7, 2016 · 1 comment
Labels
Milestone

Comments

@70fu
Copy link
Contributor

70fu commented Feb 7, 2016

I picked up the SharpNav only some time ago and I have little insight in what's going on, but I think I found a bug that prevented my agent from travelling over an OffMeshConnection.

The first while loop in PathCorridor.MoveOverOffMeshConnection sets the local variables PolyId prevRef and PolyId polyRef.
Before the first iteration the variables have the following values:
prevRef = PolyId.Null
polyRef = path[0]

After first iteration:
prevRef = path[0]
polyRef = path[0]

After second iteration:
prevRef = path[0]
polyRef = path[1]

The problem is, that the npos variable needs to be incremented before setting the new value to polyRef, so prevRef and polyRef do not have the same value after the first iteration.

PolyId prevRef = PolyId.Null, polyRef = path[0];
int npos = 0;
while (npos < pathCount && polyRef != offMeshConRef)
{
    prevRef = polyRef;
    npos++;
    polyRef = path[npos];
}

EDIT: PullRequest: #56

@Robmaister
Copy link
Owner

Thanks for finding these issues and submitting pull requests for them, feel free to continue to do so in the future.

Testing in SharpNav is pretty lacking as it is, but I have yet to test any of the off-mesh connection functionality.

If you're using NuGet I can also wrap up a few of my own changes and push out 1.0.0-alpha.3 to make things easier for you.

@Robmaister Robmaister added the bug label Feb 7, 2016
@Robmaister Robmaister added this to the 1.0 milestone Feb 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants