As a temporary side project, I hastily ported Randy Gaul ImpulseEngine to pico-8/LUA.
Requires a mouse
- left mouse button: create a random shape at mouse cursor or drag shapes
- right mouse button: show/hide world or body options
- button c: show/hide debug information
The physic engine is a direct port from Randy Gaul's work, detailled in a series of articles:
How to Create a Custom 2D Physics Engine
My contribution is mostly on a clean 2d vector and 2x2 matrix object oriented library.
It makes vector/matrix math very concise to work (and easy to port from C++ code!):
local v1,v2=vec(3,4),vec(5,6) local v3=v1+v2 -- rotation matrix local m=mat:make_r(0.4) local r=m*v3
Note: I don't plan to expand the library beyond this demo, feel free to make a game out of it!
The cart now include a context menu that could be fairly easily reused for other carts.
- Optimisation pass (currently supports ~4/5 objects max)
- initial revision
- added: support for circles
- fixed: force reset
- changed: left click now creates a new body
- added: right click menu to control world or object settings
[Please log in to post a comment]