[BEHAVIOR] Chipmunk Physics

3 favourites
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • Update #3

    * Added expressions for everything and more actions to set object properties including:

    -elasticity, friction, collision shape, mass, collision groups and collision layers.

    *Added simulation settings:

    • stepping mode: fixed or variable

    -set fixed mode timestep

    • set iterations

    -set damping

    * Added enabling/disabling and the ability to set immovable or not.

    Right now if you change the object size or animation you have to manually tell the shape to update with the "update collision shape" action. I'm not sure if I'll change that... If I make it automatic you'd have a performance hit with animated objects.

    Other than that all the functions seem to be working without errors. Feel free to try it out and let me know if you encounter any bugs. The main thing left to do now is polish up the ACE names and descriptions.

    SgtConti I've re-tweaked a lot internally so I'm not sure if that bug was squashed.

  • Update #4

    * Forgot a few expressions: forceX, forceY, inertia, angVel

    * Added Actions/expressions for angular and linear speed limits.

    * Added tagging to the constraints, so now you can reference them later either by the tag or an index.

    • along with that you can set the set the max force of a constraint.
    • also you can destroy individual joints

    * Added a pointQuery and segmentQuery conditions along with appropriate expressions. Can be used to find the closest shape to a point or for raycasting.

    I think that's about it, I probably forgot a few things.

    Current todo:

    * Polish ACE table

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Many thanks, R0J0hound. Will give this a test over xmas.

  • This is really turning out great,very promising .

  • R0J0hound

    Like to report a bug.

    I got "undefined is not a function line 2302" when preview the example in NodeWebkit. Other browsers is ok.

  • update #5

    * added preStep trigger. With it you can effectively stop any acceleration due to gravity by applying a force in the opposite direction.

    * added "on Post collide" trigger. With it you can get extra info about a physics collision such as:

    • contact points, normal, depth, impact, total energy and uid of other object.


    Ah cool, that's the same bug that SgtConti was getting and I can reproduce it with NodeWebkit. I'll try to debug it tomorrow. Firefox and chrome are working fine though.

  • This is an amazing bit of work. Seems to run smoother than box2D!

  • Update #6

    * Fixed the crash on nodeWebkit tumira SgtConti

    * Reworked it so changing the size/animation will change to collision shape automatically. As a result I removed the "Update collision shape" action which is no longer needed.

    * Fixed "pick nearest segment query"/"pick nearest point query" so it would work right when multiple object types are used.

    -Merry Christmas

  • Thanks, R0j0 and Merry Christmas to you.

  • I will definitely try this out next time I require physics in a project. I remember using chipmunk in the past, and it was really great, so I'm excited to see this for construct 2!

  • R0J0hound , it doesn't work with tilemaps. I just tested it using a tilemap, and it seems to be using the bounding box of the whole tilemap instead of the polygon that the tiles construct. Even if I switch the option to polygon, it still doesn't collide correctly.

    Box2d works correctly with tilemaps, so it would be best if chipmunk also worked with tilemaps. Any plans on implementing this?

    edit: also wondering if you'll be adding support for lines.

    edit2: been trying to use it, but adding forces to objects seems to mess things up. their points seem to become displaced and move all over inaccurate from the object.. weird... :\</p>

  • Prominent

    Tilemaps aren't properly supported yet. There is some special handling for tilemaps in the built in physics behavior, but there's a few other internal things I want to tweak before implementing it. As of right now it should work with at least sprites and tiledbg.

    I'd like to add lines but I need to think of an intuitive way to do it. I'm leaning toward just another collision shape type, along with a radius (which can also be applied to polygon and box btw). If you mean something else or have any ideas of using lines that wouldn't be handled by my idea, let me know.

    Thanks for the report on using forces, it was working but I may have broken something with an update. I'll be sure to take a look after the holidays.

  • Okay, cool.

    As for lines. I remember using them mainly for constructing a level(tracing around tiles in a tile map procedurally, combining lines that extend from each other so that there aren't unnecessary lines. I forget if I also put them into cells/groups to lower the amount of collision checks, I forget if chipmunk does that sort of thing).. There's probably a lot of uses for them besides that though. I think being able to position the ends of the lines accurately is important. I'm not sure how that would be done if it's just another collisions shape type for an object- unless you put some visual way of showing the line in the editor, and options to edit it? I imagine most people would want to specific where a line starts and ends.

  • The problem is an interface in the editor to define lines with a start and end point isn't really possible in c2's editor. We're limited to how sprites and other objects can be placed and manipulated. Another issue is behaviors can't draw anything in the editor as I recall. A way to do it from events could be done but it's not quite as user friendly.

  • R0J0hound ,

    maybe use instance.SetHotspot(p)

    for the start point, and a couple variables for the end point(or maybe use an imagepoint for the end point?).

    renderer.Line(a, b, color) for drawing the line in the editor.

    seems like a way, unless I don't understand what those are for. You probably know better than me.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)