0
\$\begingroup\$

Working in 3D in the Godot engine, I have an object that moves through space and, like a tornado, is intended to pick up objects in its path.

What I have right now is janky, effectively re-baking the Bezier every second on the second and it's causing performance issues. I'm confident there must be a better way.

What is the correct/most efficient way to path a collection of objects to a moving target?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Your question would benefit from some more details. Is your object moving across a plane, although the game is 3D? Do you want to minimise a particular cost (time, distance...), have additional constraints (no crossing paths, prioritise the closest target...) or only need a "wanderer" in your level? The "correct/most efficient" way depends on what you're trying to achieve. There are many solutions to the same problem, so reducing the scope of your question will help you get effective answers faster. \$\endgroup\$
    – liggiorgio
    Commented Apr 22 at 8:24
  • 2
    \$\begingroup\$ Have you looked into flow field pathfinding? If your number of objects in range is large relative to the size of that range, it can be advantageous to think of your pathfinding as "painting arrows on the ground" in a simple way (breadth-first search), then each object just follows the arrow under its feet instead of computing its own path. \$\endgroup\$
    – DMGregory
    Commented Apr 22 at 12:26
  • 1
    \$\begingroup\$ Are you using the Bezier for the many object or for the tornado / attractor? I would have assumed that the attractor is moving along the curve and the object move (perhaps at a rate proportional to proximity) directly toward the attractor, but that scenario doesn't require recalculating the curve - what constraints require re-baking the Bezier every second? \$\endgroup\$
    – Pikalek
    Commented Apr 27 at 15:47

0

You must log in to answer this question.

Browse other questions tagged .