ricardojmendez / UnitySteer

Steering, obstacle avoidance and path following behaviors for the Unity Game Engine
https://numergent.com/tags/unitysteer/
Other
1.2k stars 275 forks source link

Change SteerForNeighbor organization #18

Closed ricardojmendez closed 10 years ago

ricardojmendez commented 10 years ago

Currently the SteerForNeighbor behaviors, such as SteerForCohesion, SteerForSeparation and SteerForAlignment, all come from a base class on which CalculateForce iterates over the detected vehicles, checks if they're still valid, and verifies that the vehicle is in the neighborhood before adding up its contribution.

This has the advantage that we can configure some values such as the angleCos on a per-behavior basis, but the disadvantage that we're evaluating some values and iterating over the list multiple times, when one could suffice.

I'll update it so that:

This will likely make a difference mostly on larger clusters.

ricardojmendez commented 10 years ago

Implemented. https://github.com/ricardojmendez/UnitySteer/commit/bd4c73bb0c2d26b9f54abc44f67245c18b25af57