[BEHAVIOR] Chipmunk Physics

From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • It's not using the object's origin, it's just using the center of the object regardless of where the origin is. It was an oversight to not take into account the center of a polygon shape. I'll be taking a look into it.

    Dont want to seem pushy but how is this coming along.

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    I'm wondering if this plugin can handle the complex apparatus I'm attempting to build, mentioned here in another post a few days ago?: https://www.scirra.com/forum/how-do-i-slide-pivot-catapult-from-a-movable-platform_t129971

    I've read through all 31 pages here, and numerous tutorials, but so far I haven't been able to pick out (or recognize) the correct combination of material and/or examples that would help me get this built. The previous post contained a capx based on the Physics-Catapult template. This is as far as I've gotten with the Chipmunk2D addon:

    http://www.webmagi.com/media/uploads/scirra/Slide-Pivot-Catapult-2.capx

    Can this be done with Construct2?

    Thx

  • Pin joints aren't like the pin behavior. They are a rod connecting two objects. So when you add the joint the distance between the anchor points are kept. See the js demo of it here:

    https://dl.dropboxusercontent.com/u/249 ... oints.html

    R0J0hound

    Are there examples of these joints used in Construct2?

  • spongehammer

    Haven't started working on it yet.

    WebMagi

    This behavior would be useful for the simulation part of what you're doing. Adding the joints should be as easy as using one of the add joint actions and specifying the two objects and stuff like where the joint should be.

    To make the object manipulable with the mouse you can use something like the drag n drop behavior as a base. To move other objects when dragging one you would need to move them by the same amount, the pin behavior could be used for it.

  • R0J0hound

    Thanks for the info, and your time.

    In the capx I provided above, you can see that I've already added a gear and pivot joint to the Base and Pivot sprites, and a touch event for the Slide sprite. What I am lacking in are examples or documentation of the type of mechanism I'm trying to build. Mine is ridiculously inadequate. I contacted support hoping they could direct me to such examples or documentation, and was told: "it's absolutely unclear what exactly you are trying to achieve". So it's very likely that I have been too vague with my descriptions. To help clarify, I made a short video covering the functionality I am hoping to achieve.

    Please know that I am not asking for anyone to do the hard work for me, I am only asking for working examples and/or documentation that could possibly aid in my efforts to build what appears to be a one-of-a-kind Consturct2 compound structure.

    Here is the video: https://youtu.be/jaLWHBlhSmQ

  • WebMagi

    I can't think of any examples off hand, but a search for "angry birds" on the forum will give examples of a slingshot which is similar.

  • R0J0hound

    Sure, the "Template-PhysicsCatapult.capx" that comes with Construct 2 is a knockoff of angry birds. And originally I started with that template, but their whole approach does not seem conducive to what I'm trying to build. I've opened and reviewed hundreds of capx files, but so far I'm not finding a lever attached to a pivot, which acts like a tension spring when pulled backwards. Actually, the hardest thing seems to be creating a lever attached to a pivot, which slides along the top (and acts like a tension spring when pulled backwards), while also being able to pull up or push down on the pivot at every point along its entire length. So this has never been done?

    I've searched the forum for catapult, which is closer to my contraption than a slingshot, but I have not come across the right combination of examples.

    Your Chipmunk2D addon seems to offer greater flexibility than the default Construct2 physics, and the Joints demo: https://dl.dropboxusercontent.com/u/2494815/demo/Joints.html looks like the right place to start. So there are no examples of these joints being used in Construct 2?

    My apologies for being such a pain.

  • WebMagi

    It's just a matter of using joints to link it together. Then to manipulate it with just physics you can use a dummy object that's moved by the mouse that you connect and disconnect from objects. Here's an example of a possible way to set it up.

    https://dl.dropboxusercontent.com/u/542 ... aunch.capx

  • R0J0hound

    You are absolutely brilliant! This example should come standard with Construct 2. I'm assuming I can use a Touch object in place of the Mouse object? Freaking awesome!!!

  • I'm getting the following error:

    Javascript error!
    Error: Assertion failed: Internal Error: Attempting to set body's angle to NaN
    http://localhost:50000/rojoChipmunkBeta_behavior.js, line 52 (col 8)[/code:sxux02kw]
    
    It appears to be related to the 4th action: [i]"gear joint to keep the angle of the plunger the same as the lever"[/i]. When I toggle it disabled, the error goes away. Could my polygon collision shapes be causing an issue with the 0 phase setting?
  • Never mind. I had the lever (plunger) "Prevent rotation" set to yes.

  • Any progress with that parent of 'undefined' error R0J0hound ?

    If necessary, I can try creating an environment where the bug occurs more consistently whenever a collision happens.

  • R0J0hound

    I am deeply enjoying your physics behavior. Thank you!

    I got an issue though. When I am colliding two sprites with the behavior, the one that I control, actually goes into the other sprite. It seems like it doesn't stop at the sprites collision box. Is there a way around this?

    I am using the car behavior on sprite 1. Sprite 1 is being ran into sprite 2, sprite 1 goes inside sprite 2 making it appear unrealistic.

    Thank you!

  • striimix

    Sorry I haven't had a chance to look yet. I've been in a programming slump.

    GameThirsty

    It doesn't really play well with other behaviors. To make it respond realisticly you need to move the object with only the chipmunk behavior.

  • R0J0hound

    Thanks for the heads up R0jo, I guess that happens to all of us sometimes. I could do an "ugly" solution just by pinning impressions over the sprites but then I would need to have a pinned sprite on top of each body part of the ragdoll to later show damaged body parts for example (so it's not really that good option...) Being also a bit of a perfectionist in optimizing things to the extreme, I wouldn't be satisfied by makeshift solution that would clutter things unnecessarily...

    so I'll continue looking into the source, and if I make any progress pinpointing a possible solution I'll post here... luckily the commenting is very good (I'm really impressed with your work... I even was able to get rather good performance on the first iPad when using Chipmunk physics).

    GameThirsty

    Just like R0j0 said, it's best to recreate control logic with chipmunk..if you're mixing several behaviors together, you sooner or later will face situation where the logics are clashing... if you're making a car game, you could make acceleration by tweening a value towards certain velocity, for example) - I would recommend at least completely rethinking what things you need for the game, and defining them.. then think how to do them with chipmunk (it's very diverse).

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