Log In  

Cart #52460 | 2018-05-06 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
19

As a temporary side project, I hastily ported Randy Gaul ImpulseEngine to pico-8/LUA.

Usage

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

Dev Log

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.

Missing Features:

  • Optimisation pass (currently supports ~4/5 objects max)

Change Log

1.0:

  • initial revision

1.2:

  • added: support for circles

1.3:

  • fixed: force reset
  • changed: left click now creates a new body
  • added: right click menu to control world or object settings
P#52222 2018-05-01 08:32 ( Edited 2018-05-06 16:44)


[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-19 05:17:05 | 0.013s | Q:14