Announcing new physics engine in AS3

Besides audio-programming, still the big thing to be solved in AS3. I’m currently working on a game in as3 (YEAH!) and it needs some accurate physics. I decided to spend some more time to build a flex-library for further projects and development on this topic. There are still a lot of things to implement and some collisionmodels need some proof of robustness.

Features:
ConvexPolygons as Springmodels
Time-exact simulation resolve
Space-Subvision by grids

sources
. drag the corners
.

{firefox still sucks}

33 thoughts on “Announcing new physics engine in AS3”

  1. Here’s a bug…

    ====================
    7
    Error: ……….getNearestCollison………
    [Object: CollisionConvexPolyEach]
    ====================
    opps i forget to fill in the anti-spam question before submitting the comment… so I forget some of the error detail =[

    anyway I know this engine is still in the early stage and good work!

  2. Andre,

    One thing I’d be interested to know is how you generated the CircleSegments data for the immovable shape?

    Thanks!
    -Ash.

  3. @ash:

    I’ve created a simple editor for them. It would be much cooler to spend some time on a more complex editor to provide creating big physic-scenes, but for the current project its completly adequate to what I need.

  4. amazing stuff as usual! I’d love to get deeper into the code – if I only had a clone who could take care of money and household in the meantime ;)
    Do you know why RegularSpringPolys act like sprites on speed when they have more than 5 corners?
    keep up,
    basti

  5. The springs are not integrated over time while the collision-response is acting. They are only updated each frame. For more corners, you should create the springs manually.

  6. I’ve noticed, that the motion speed is not constant (waving a little), more visible on weak machines. I have the same problem in my AS3 applications. I’ve tested them with getTimer() and found that some simple linear code snippet can be executed in 1 millisecond or in 50(!) milliseconds (rare but periodic).
    Possible this is Garbage collector (runing several times in second). What should we do, guru?

    Tell somebody to Adobe to make global property .disableGarbageCollector to disable it temporary if needed… :)

  7. Andre, thanks for the great work! Love the performance of this engine (and AS3).

    Can you tell us if you’ll implement more classes than just ..complex.RegularSpringPoly? I’m wondering if I should work on a RegularCircle, RegularWheel, etc.

    Also, what do you think of a non-corner based method of grabbing these polys? You may not need it but it seems more intuitive for me to grab anywhere inside the polygons. I was thinking of creating maybe two mousesprings instead of the current one…

    thanks-
    Paul

  8. dennis, i can give you some advice. the garbage collector removes unused instances etc. so a possible workaround is to reuse your instances instead of creating thousands of new ones :)

    this will speed up the garbage collection. of course you will recognize a lag in performance but a smaller one.

  9. to Joe: Yes, I know, some experienced people can tidy their garbage themselves :)
    Anyway the lag amounts to 20-50 ms. It’s noticable for smooth lineal motion.
    And the most bad thing is GC works asynch, and there is no way to forecast this perfomance lag…

  10. Great work!!
    Are these bricks rigid body?
    How do you build those walls? Bezier curve?
    It’s REALY fast and accurate, have you tried impliment joints?

    Do you know ODE, the Open Dynamics Engine? There is also a java version ODEjava. with AS3, I think it’s possible to implement a AS version of ODE.

  11. Good work. Is this a sideeffect of our german weather these days ?

    The problem with Javaode is that it`s a (API)wrapper and not rewritten in Java. And javaode already has it`s own problems.. so someone would port a port wich allready has problems. If this could end up well ?

  12. And I’d guess that Andre’s verlet engine will run a lot faster than ODE in AS3. His stuff seems pretty efficient and verlet is generally faster than a rigid body simulation like ODE.

    Fun stuff!

  13. Hi, this looks really cool.

    I was just wondering: What kind of license will this be released under? … And what am I allowed to do with the current source code?

    Thanks,

    -Matt

  14. what do you think of a non-corner based method of grabbing these polys? You may not need it but it seems more intuitive for me to grab anywhere inside the polygons. I was thinking of creating maybe two mousesprings instead of the current one…

  15. for grid subdivision have you thought about quadtrees? would also be fairly fast for repositioning geometry?

  16. I don’t know the status of this engine, but I can tell that it seems better than the current ones even though I posting my comment three years after this engine was released. I used other engines, and didn’t see any support from any available engines for drawing the edge shape (yellow) as the ground.

    Sincerely,

Comments are closed.