[BEHAVIOR] Chipmunk Physics

  • [quote:h6zl67ei]Is there a way to set linear or angular damping per object?

    It's not a built-in feature of the chipmunk library but you can do it by either:

    1. setting the velocity to say (velocityX*0.9, velocityY*0.9) where 0.9 is a value from 0 (total damping) to 1 (no damping)

    2. applying a force in the opposite direction as the velocity or angleOfMotion.

    [quote:h6zl67ei]Prevent rotation is another handy feature that's missing

    True. I just need to find a good way to work that in.

  • I am curious, why did you decide to use chipmunk? Was there a defining feature that made it more feasible to add to construct2 than box2d?

    I have been looking through chipmunk and comparing box2d to it. I like all the work you have done, but it seems that some of the features (such as this frame jointing and position setting ) are more a product of how the behavior is written than the physics engine. Is this correct?

  • It was kind of an arbitrary decision, either library would've worked. Box2d is already used in C2 and CC so I thought I'd try chipmunk instead. It's due to some bias too since I've only coded with chipmunk and my only exposure to box2d was the behaviors, which have some quirks that make then unwieldy sometimes. But to be fair the quirks are probably due to the way the behavior was written instead of how box2d was written.

    The actions to add joints are pretty much the same as the js functions to add joints. The only thing I added to them was the ability to use either rectangular or polar offsets.

  • R0J0hound

    There seems to be some issue with the sleeping check. See the attached capx. It does seem to work sometimes but not others.

    Thanks

  • Updated to version 1.2:

    * Bugfix: Once a force was applied to an object it could never go to sleep. spongehammer thanks for the bug report.

    * Added actions and expressions for more control over sleeping:

    • sleepTimeThreshold, the amount of time an object has to be idle before going asleep
    • idleSpeedThreshold, the maximum speed an object can be going and still be considered idle.

    *Added "Prevent rotation" property that keeps objects from rotating when colliding. (Basically Infinite inertia) mattb

    • Also added an action to set it and a condition for it.

    * Added conditions "is enabled" and "is immovable" as well.

    * fixed the mass and inertia expressions to return correct values when the object is immovable or unrotatable.

    -cheers

  • Excellent work as always . Thanks

  • yay! looks like some nice additions

  • R0J0hound , btw.. is there anything specific stopping you from tilemap support? or are you just unsure how you want to implement it yet?

  • Prominent

    It's not as trivial to add support for as most of the other features added so far, but that's not really stopping it. It just may require a bit more time to do once I start implenting it.

  • ROJO is best hound around here thanks rojo

  • Great stuff Rojo, the prevent rotation is appreciated.

    I've been trying out constraints today & something that might make the menu more user friendly would be the ability to choose an imagepoint in addition to the rect/polar offset options. Also a pick object menu would be handy.

    ps. me & Prominent will buy you some dog biscuits in return for tilemap support

  • Thank you for your hard work R0J0hound ! I went ahead and made a little icon to go with the behavior. You can tell right away that it's an icon for a physics behavior right? Anyway, anyone is free to use it if they like it, download link is below.

    https://dl.dropboxusercontent.com/u/7421687/PluginIcon.ico

    Here's how it looks in Construct:

  • Try Construct 3

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

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

    A simple manual would be great. I really thought common sense would kick in once i started using some of the features. However this has just pointed out i dont have any

    Another thing while i am here. I have noticed that applying Keyboard UP or Keyboard Left returns NaN for the speed.

  • Has anyone done some benchmarks for this? How does it compare to box2d web and ams.js?

  • Can't be any more help, other than to say this plugin has a pretty big performance leak. All I did was left the demo you have running for a couple hours, came back, and it was running at 10fps from 60fps.... turned it off, then back on again, and it was fine. Perhaps it was a fluke? I'll do it again tonight before I go to bed... to see where it's at in the morning.

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