[BEHAVIOR] Chipmunk Physics

3 favourites
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • Any new insight on that memory leak R0J0hound? I love this behavior a lot but unfortunately I'm experiencing a severe slowdown for the FPS over time, even when nothing is moving anymore in the scene..

  • Any new insight on that memory leak R0J0hound? I love this behavior a lot but unfortunately I'm experiencing a severe slowdown for the FPS over time, even when nothing is moving anymore in the scene..

    None since my last observation about it. Something that should be deleted isn't because something is keeping a reference to it so it's not being gc'd.

    Anyways consider all my plugins in their final state and won't be updated.

  • Alright!

    Just out of curiosity, have you moved on to some other game engine?

  • Nope, I'll probably go engineless. Presently I haven't been doing much coding at all.

    Since I only code for fun, things like maintaining previous projects fall by the wayside.

  • Oh Yeah!

    We Found It!

    Thank You All!

    app.box.com/s/jt9f8r1mqmq07pbthiydvrgzikp5d29f

  • R0J0hound

    Please check the attached gif

    i.imgur.com/LK2sMIq.gifv

    Attached capx

    cdn.discordapp.com/attachments/498916402195857408/499148545769734144/StdPhyVsChpmnkPhy.capx

    I know you are not developing the behavior anymore, but I wondered if you can give any feedback on this. I'm not sure if I placed the joints correctly in chipmunk, but it seems there is no way of getting similar non-breaking rotation as the standard C2 Physics behavior. Is there anything that can be done? Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Instead of setting velocity have you tried adding a motor joint to yellow instead? Or maybe apply a torque if the angular velocity is too low.

    Physics engines don’t seem to like it when you set positions or velocities, but maybe Box2D can handle it better? My best guess why it’s different is the chipmunk library does things differently somehow.

    For best results the engine likes doing stuff with joints, forces and impulses.

  • R0J0hound

    I added a motor joint to yellow, and it did stop it from getting displaced, but red still gets displaced, and yellow also gets displaced if I make the black sprite collide with yellow directly.

    From what I can see the C2 Physics just stops or slows down its rotation to prevent displacement while Chipmunk just rotates regardless, which I guess is a more consistent but with the side effect of displacement.

    I guess it is how it is. Only if the standard C2 Physics had collision filtering per instances of the same object like Chipmunk does. And looking at the files It looks impossible to hack it into the C2 physics behavior.

  • You can also set the strength of the motor. By default it will use up to an infinite force to make it turn. There’s an action to change the setting of a joint by tag. Use “” for the last created joint.

    I forget if there were other settings you could do for other joints. Guess you may need to refer to the chipmunk manual. This plugin is just a wrapper for the chipmunk library. There are things it can do that I’m not familiar with.

  • Oh ok I'll look into it then. i wasn't aware of a motor strength option. Thanks.

  • R0J0hound

    Not sure if this is a bug or not, but it seems in Chipmunk the 'angular velocity' set is twice as fast as it should be.

    I used speed=distance/time. Constant time, a set target angle, I calculate the angular speed. I used a timer to stop the rotation after the set time.

    In standard C2 physics behavior it reaches the target angle as expected, but in Chipmunk it would over rotate, then I just divided it by 2 and then it worked fine. Both C2 Physics and Chipmunk is stated as degrees per second.

    This does not need any updating of the behavior as we can simply just divide by 2, but I thought I'd put it out there.

    Also Chipmunk crashes if I make an object rotate past its min or max angles set in its limited rotary joint.

  • It’s twice as fast because the timestep is set to 1/30 by default. Setting it to 1/60 will be closer to par. You can also set the stepping from fixed to frame rate independent but it seemed to make things more unstable.

    That’s no good it crashes. Guess that goes along with not setting position and velocity for best results, which includes angles.

    Sounds like something that would need to be fixed in the library itself.

  • Thanks for clarifying. My bad.

  • R0J0hound

    Do you have a discord or any means of privately messaging you? I need your feedback on something. Might as well post it here, doesn't have to do anything with chipmunk

    cdn.discordapp.com/attachments/183566321156358144/502108488869085196/rot.capx

    Was trying to make a voxel type editor but it is not very efficient at all.

  • I have a discord I haven’t used in ages. I probably should install it again.

    Edit:

    My discord name is reddog

    Had a look in your capx. Didn’t have “Rex function” or “polygon” installed so I removed them. Looks like one wasn’t used and the other, polygon was just another option from paster.

    I will say the polygon plugin is probably your biggest bottleneck. It has the same issue the canvas plugin had. It draws to a hidden canvas first and is copied to a webgl texture. This is slow and uses a lot of memory when drawing many polygons.

    I noticed you’re using some JavaScript. I usually define the functions once in a start of layout. To make the functions accessible later you’d define them as

    window.myfunction = function(){};

    Instead of

    var myfunction = function(){};

    Or

    function myfunction(){}

    And the beauty of it is you’d still be able to call the function as myfunction().

    Window is the global object.

    You can do it with just events as well. Might look more readable.

    One thing I do to make my expressions more readable is to avoid using tokenat or even array.at as much. Probably just a personal preference.

    For max performance you could do almost everything in JavaScript and only do minimal stuff in events like add cubes, set the view rotation, and request it to be drawn. Kind of loses the fun of using construct though if you run into js errors.

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