I’m brainstorming a way to handle local avoidance efficiently for DPhysics. Before, I’ve been applying physics forces but this can lead to undesirable results when units get clumped up or want to pass through a group. Here’s what I’ve come up with so far:
Units have a ‘Priority’ value that’s similar to mass except for an RTS game. If a unit has higher priority, it pushes by units and isn’t affected by a collision. By ‘pushing’, I mean applying the offset to the other unit to not overlap.
If 2 units have the same priority, the ratio of Unit A to Unit B’s speed is determined - this ratio is used to apply the offset to stop the overlap. The higher the velocity of Unit A, the less the offset applied to Unit A and the higher the offset applied to Unit B.
This is just what’s been going on in my head. Do you think it’ll work?