ReeseUnityDemos icon indicating copy to clipboard operation
ReeseUnityDemos copied to clipboard

Handle translation deltas that exceed consecutive path points

Open zlxt2714 opened this issue 2 years ago • 1 comments

Bug description:

When the speed of the agents in the scene exceeds 30 (Translationspeed = 50F), some agents will get stuck in place, and some will shake violently when they reach the target point. If navflocking is turned on, the agent will circle around the target point. So how to solve this problem?

zlxt2714 avatar Sep 06 '21 00:09 zlxt2714

Thanks for submitting this issue. It gives me an opportunity to explain how the navigation works at a glance, and why this happens.


You have to supply reasonable parameters for navigation to work, in the same way that you do for physics, shaders, etc., although I understand the need for input validation where possible.

The navigation package generates a buffer of navigable points. If the translation delta of an agent exceeds the distance between a set of consecutive points, the agent will, as you put it, shake violently, because it's unable to "reach" said points—and it will keep trying indefinitely. Keep in mind that whether a point is "reached" is approximate, since positions are stored as floating-point numbers.

Input validation for this is challenging. For example, points could be removed to account for the translation delta; however, those points exist for a reason: the avoidance of obstacles. In this way, if we remove a hypothetical Point B between A and C, then we have no assurance that the vector between A and C is navigable/walkable.

Another way to go about this would be to temporarily slow the agent. Thus, the TranslationSpeed would effectively become a MaxTranslationSpeed. Maybe a name change would be in order.

All in all, I'll consider slowing agents conditionally with a distance check. I'm also curious if anyone has input on that, or agrees with that approach. Let me know if you do. Also, maybe MaxTranslationDelta would be more appropriate than MaxTranslationSpeed, because it's best thought of as change in units (meters by default) over time.

In the meantime, just lower the translation speed. Or, hey, I literally added an option for the agents to teleport. Use that if you want them to go really "fast."

reeseschultz avatar Sep 06 '21 02:09 reeseschultz

Closing, see #99.

reeseschultz avatar Aug 11 '23 20:08 reeseschultz

您的邮件,我收到了,谢谢。

zlxt2714 avatar Aug 11 '23 20:08 zlxt2714