SLRBS demo

February 11th, 2009

demo image

Here’s a demo of the auto-gen physics engine (SLRBS- Super Lightweight Rigid Body Simulator) I’ve been working on which allows you to select images to use as rigid bodies. First, the image is analyzed, ignoring transparent pixels, to determine its convex hull. Then mass/center of mass/inertia tensor are solved for. Finally, the rigid body is created and dropped into the world.

I’m sure that in playing with it, you’ll notice all sorts of wonky behavior… but I think it’s fun anyway. Let me know if there’s a class or type of shape/image that tends to be particularly misbehaved!

demo
image pack

drew ActionScript 3.0, Flash Player 10, Geometry, Mathematics, Physics

  1. Macaca
    February 12th, 2009 at 05:21 | #1

    Very nice, im really interested in yoru convex-shape-extracting method.

    Also: I couldn’t wait to try the demo, but the Add File dialogue wont let me select images (not my own, nor those in your pack). Im on Windows XP, FP10(debug), it looks like the file-type filer blocks my images from showing up in the file browser (it says ‘image formats’ in the selector, but it doesnt seem to include png/jpg).

  2. dVyper
    February 12th, 2009 at 09:27 | #2

    Absolutely amazing :O :O

  3. February 12th, 2009 at 09:50 | #3

    @Macaca
    I’ll be covering the image analysis in a post when I release the geometry library in the near future, but it goes something like this:

    1. Take an IBitmapDrawable and draw it into BitmapData
    2. Find the convex hull using Andrew’s Algorithm
    3. Determine (read: guess) whether the shape is a circle. If so, find center and radius and exit algorithm.
    4. Reduce convex set returned from Andrew’s Algorithm. You can get a shitload of points that represent the convex hull and ideally you want as few as possible. This is a finicky process, with a few algorithms involved, but I’m fairly happy with the result as they’re all based on intuition.
    5. Assign geometry- if there are 2 or 3 points, it’s a line segment or triangle, respectively. Otherwise it’s a convex polygon.

    I put up a swf without the filter here- hope that works!: http://lab.generalrelativity.org/glib/SLRBS/autoGen/autoAdd/noFilter/

  4. jos
    February 12th, 2009 at 21:54 | #4

    What are the chances of making this work for top-down style games? I’m working on something where i need collision stuff, but its not a side-view kind of thing…

  5. February 13th, 2009 at 00:55 | #5

    @jos
    All forces, gravity included, get added modularly per the developer’s discretion, so there should be no difference in the eyes of the physics simulation between top-down and side-scrolling.

  6. jos
    February 13th, 2009 at 16:23 | #6

    Excellent. Looking forward to checking out your library when you release it. Thanks for the hard work and making it public.

  7. August 4th, 2009 at 06:44 | #7

    Do you have a date or month it will be released?? How far have the development come? Im realy looking forward to use this in my current game.
    Keep up your excellent work.

    Btw FOAM don’t suck:D

  8. nt
    November 24th, 2009 at 09:59 | #8

    Hi,

    Does this work is still in progress? Have you done a first release?
    Thanks for all your great jobs!

    Cheers!

  9. November 29th, 2009 at 14:35 | #9

    Unfortunately I never continued work on SLRBS or my geometry library. Maybe someday I’ll get back to it just to get it to a state worth sharing.

  1. No trackbacks yet.