This library adds the normal love.physics by allowing bodies to be influenced by another body's mass, called gravity, as well as some small other things. The following is a demonstration of what Grav2D can do in 38 lines of code:
(This example is attached with the library as an example)
Currently, Grav2D has 5 major functions:
Code: Select all
Grav2D.new(body,shape,mass)
Code: Select all
[Grav2D Object]:applyGrav()
>Returns a debug table with the average force, angle (in degrees), and distance, as well as a world body count
Code: Select all
[Grav2D Object]:draw(mode)
Code: Select all
Grav2D.toCartesian(r,θ)
Code: Select all
Grav2D.toPolar(x,y)
TODO:
- Make Blacklisting/Whitelisting body arguments to :applyGrav()
- Optional make :applyGrav only return debugTable
- Allow bodies to be attracted to arbitrary points in space or axes
- Give support to non-polygon or circular shapes
- Give option for polygons to attract object based on which side the object is closest to
- Anything you guys suggest that sounds neato