Physics Ability Example - Exorcism
Here's in the breakdown of an ability that spawns units and moves them with rotation, making use of the Physics library
The end result while there is no enemies to go to would be like this:
I include a Debug boolean that can be enabled to show the path and acquisition of different states:
The complete codes for the ability can be found in the following SpellLibrary links:
The entire lua file has comments for every decision. I hope it helps understand and adapt this skill to different behaviors.
I'll just leave the lines related to physics here, special thanks to BMD for helping me through the entire process of rewriting this ability.
First step is to make each spawned unit a physics units and apply the properties.
Physics Readme to know what these do.
After this, we want to control the units behavior on each frame, making use of the OnPhysicsFrame function.
Last is to stop the units, very simple with this:
For a different logic, check Locust Swarm from DotaCraft repository, it uses the same movement physics but has different acquire and return logic, to fit Warcraft 3 behavior.