Closed Tricnic closed 4 years ago
Good catch! The code change you're suggesting corrects an oversight for sure, but it impacts the NavMovingJumpDemo
, resulting in falling agents who jump from a particular angle. My impression is that this is related to #21, so I need to tackle both issues. "Sticking a jump" is kind of a hack where I've been forcing re-planning, but obviously that's not a rigorous solution. I'll dig into this and see what I can do.
Said problem was not related to #21, but instead related to this vestigial line of code in the NavInterpolationSystem
:
localWaypoint.y = agent.Offset.y;
@williamtsoi ran into issues with that line of code as well in #37, so I'm just going to remove it from the main branch now.
Patched in nav/v0.10.4
. Thanks @Tricnic for finding this issue.
Bug description:
When a NavAgent is traversing a path and NavNeedsDestination is added, causing the path to be recalculated, NavAgents will skip part of the new path, possibly passing through obstacles and/or going off the NavMesh.
Steps to reproduce the behavior:
Expected behavior:
The NavAgent should follow a new path around the cube.
Describe alternatives or workarounds you've considered:
I was able to get the NavAgent to follow the new path by adding
agent.PathBufferIndex = 0;
on line 135 of NavPlanSystem.cs afterpathBuffer.Clear();
I don't believe there are any far reaching ramifications to this change, but I could be wrong.