daniu54 / earie-treasures

A 2d top-down loot-em-up with horror and stealth elements
0 stars 0 forks source link

Investigate how to cashe or pool calls to path recalibration when using `NavigationAgent2D` #7

Open Abb4 opened 1 year ago

Abb4 commented 1 year ago

Currently we use NavigateTowards2dNodes to navigate between multiple waypoints. These waypoints can be static or positions of Nodes. Current implementation of NavigateTowards2dNodes sets NavigationAgent2D.TargetPosition every process tick:

NavigationAgent2D.TargetPosition = currentTarget.GlobalPosition;

This may be too expensive, especially for static waypoints. Maybe godot does cashing on its own. Or maybe it would be nice to implement our own solution with a cache over positions