A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 57

Thread: [WIP] 2d rigid body physics engine

  1. #1
    Senior Member
    Join Date
    May 2006
    Location
    Manhattan
    Posts
    246

    [WIP] 2d rigid body physics engine

    demo: http://lab.generalrelativity.org/foam/friction

    i started work a few weeks ago on a rigid body physics engine. mostly because it's challenging and fun for me, though i will be releasing it all open-source.

    there are currently no optimizations in place and there's a ton i'd like to add. it's built with the idea of being very extensible and has some sexy stuff going on- i'm happy to share with anyone interested

    a lot of the physics engines out there dont' seem to portray weight appropriately- same with friction so those were 2 of my main goals.

    anyway, i'm interested in your thoughts. thanks!

    sorry for the enormous dimensions...

  2. #2
    Senior Member rachil0's Avatar
    Join Date
    Jul 2007
    Location
    Columbus, OH.
    Posts
    465
    Really neat demo! I like pulling the pentagons around on the ground with the mouse - sometimes they slide and sometimes they spin like wheels, depends upon how gently you tug them. Very satisfying emergent behavior. What kind of integration does it use? Seems very stable.

    I think another neat primitive would be a polyline mass/spring system or something - to make flexible chains that are articulated. I suspect this is easy to do. I would think you could compose them out of multiple point masses and interconnecting springs. For the point masses inside the chain, I would make them ineligible for collision detection and don't even render them to screen - so it still looks like 1-pixel rope, but it's bendy rope.

    If those two tethers that held up the platform were decomposed into chains, I think you would get really neat emergent behavior when you dropped a mass onto it from a high height - the recoil back up could slacken the chains and make it form interesting shapes other than just straight lines.

    It's very fun.

    EDIT: added an old example AS2 .swf that models a mass-spring polyline thing. (left/right/up moves the ship, pick up the block with the tow cable, space releases the block).
    Last edited by rachil0; 01-07-2008 at 04:51 AM.

  3. #3
    Elvis...who tha f**k is Elvis? phreax's Avatar
    Join Date
    Feb 2001
    Posts
    1,836
    Very nice engine, newblack
    Streets Of Poker - Heads-Up Texas Hold'em Poker Game

  4. #4
    Senior Member AzraelKans's Avatar
    Join Date
    May 2002
    Location
    Hell... with frequent access to heaven ;)
    Posts
    409
    Very nice indeed, what are you using as 3.0 or as 2.0?

    Just a detail, could it be possible you added some walls to keep the objects from leaving the scene? I ran out of objects because I keep tossing them outside the screen.

  5. #5
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    All I get is a blank grey screen, the window is titled 'Flash Player Installation-", and I have the very latest Flash Player.
    http://www.birchlabs.co.uk/
    You know you want to.

  6. #6
    Game Player - Developer scheletro's Avatar
    Join Date
    Mar 2005
    Location
    México living in Barcelona
    Posts
    1,121
    I have some problems loading the page


    "I love to make them as I love to play them"

  7. #7
    Senior Member TheLostGuru's Avatar
    Join Date
    Aug 2004
    Location
    I live on this webpage...
    Posts
    784
    Wow! I was very impressed. I will be interested to look at your code when you release it.
    "If I have seen further it is by standing on the shoulders of giants." Isaac Newton
    ------------------------------------------------------------------------------

  8. #8
    Senior Member
    Join Date
    May 2006
    Location
    Manhattan
    Posts
    246
    thanks everyone

    @rachil0-->
    cool constraint demo- i plan on adding lots of different constraints: bungee cords, rope etc. this demo uses a Runge Kutta numerical integrator. i modeled the ordinary differential equation/solvers after "open source physics": http://www.opensourcephysics.org/ which allows for easy switching of solvers.

    @AzraelKans-->
    it's AS3. i'll share a new demo when there's new stuff to show

    @VENGEANCE/scheletro-->
    sorry- no idea why... out of laziness it's the canned *everything* flash player detection that comes with an ActionScript project in Flex Builder. faulty player detection is a huge pet peeve of mine, so i'll look into it when i get home from work.

  9. #9
    Game Player - Developer scheletro's Avatar
    Join Date
    Mar 2005
    Location
    México living in Barcelona
    Posts
    1,121
    now I can see it!

    Very impressive, of course i want to know how is been made, wow


    "I love to make them as I love to play them"

  10. #10
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    excellent work
    lather yourself up with soap - soap arcade

  11. #11
    5+5=55 Schfifty Five's Avatar
    Join Date
    Jun 2006
    Posts
    698
    Wow. This is an amazing demo I can't wait to see what can be made with this. Great job!

  12. #12
    FK founder & general loiterer Flashkit's Avatar
    Join Date
    Feb 2000
    Location
    Sydney
    Posts
    1,149
    Really nice work, I can't wait til you release it!
    Regards Mark Fennell - Flash Kit Founder, general loiterer
    -------------------------------
    I Hate Zombies - iPhone Game | markfennell.com

  13. #13
    Member
    Join Date
    Aug 2007
    Posts
    61
    Nice, are you planning on turning into a general engine? It eats my CPU at the moment...

  14. #14
    Developer
    Join Date
    Apr 2007
    Location
    UK
    Posts
    324
    Like rje it consumes about 95% of my CPU. Thats not good news at all really. Unless you plan to only do technical demonstrations with it. But its extremely impressive nonetheless.

  15. #15
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    crashed my browser at home , runs ok here at uni but lots of CPU consuming. If I were to improve it then it would be 90% of the resources for good performance

  16. #16
    Senior Member
    Join Date
    May 2006
    Location
    Manhattan
    Posts
    246
    Quote Originally Posted by newblack
    there are currently no optimizations in place
    there's tons that needs to and will be done for performance

  17. #17
    Senior Member Alluvian's Avatar
    Join Date
    Jun 2006
    Posts
    967
    Keep up the good work. I can see doing a physics game maybe as my third game (wow, talk about getting ahead of myself!!) and the more engines out there the more likely I will find one that will work for me and that I can comprehend!

    I love playing with physics games. Not sure if my math is up to snuff enough to make them though. Funny that I got straight A's all through my physics courses, straight A's through Calculus all the way through Calc4 (linear equations I think? The one with all the fourier transforms). Okay, I got a B in calc 2. I suck at integrals. And now I don't remember ANYTHING about that stuff. Use it or lose it is true I guess.

  18. #18
    Senior Member
    Join Date
    May 2006
    Location
    Manhattan
    Posts
    246
    Quote Originally Posted by Cortana
    Unless you plan to only do technical demonstrations with it.
    I don't know how much flash devs really use physics engines... my guess is that a large percentage of the time a custom solution is implemented. I'd like this project to be an extremely well-documented, well-commented, open-source reference. the math/physics/geometry involved has been pieced together from a wide variety of sources- none of which are well documented/straightforward (though i've never studied physics, so maybe i just don't get it!). basically i'm attempting to build what i would have wanted to find when starting out.

    Some of the stuff I'm doing is purposefully not optimized so as to be extensible and applicable to a wider range of problems.

  19. #19
    Senior Member
    Join Date
    Aug 2007
    Location
    Spencerville, Ontario, Canada
    Posts
    146
    rachil0: Thats really cool that chain thing, I like that a lot. Neat! A also like the physics engine, neat.

  20. #20
    Senior Member
    Join Date
    Dec 2005
    Posts
    426
    that is really really really awesome i hope you are done soon.

    you should also add circles

    also i found a glitch with the sticks, you can pick them up from anywhere as long as the mouse is on the same _y level as it.
    Last edited by jasonpeinko; 08-30-2007 at 08:41 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center