[BEHAVIOR] Chipmunk Physics

  • Update 2.1a:

    Download i first post.

    *Fixed: Creating object during "pre step" or "post collide"

    kmsravindra

    It stops moving due to object sleeping.

    You can disable sleeping with the "Global Settings"->"set sleep time threshold" action. A value of Infinity is disabled.

    Document tidbit:

    The way sleeping works is the object will be put into a non-moving "sleep" state if it's idle for a time equal to or longer than the "sleep time threshold". The object is considered "idle" if it's speed is less than the "idle sleep threshold", which by default has a value based on the gravity.

  • R0J0hound , I have a question about creating objects during the on post collide. When you create the same type of object as the object calling the post collide, and that object is created in the same position, size, as the original object- does that new object instantly call a post collide event before the current event is finished??

    I'm having strange results when I do this, and it seems like it gets called more than it should- so objects keep getting created even when I check to see if the position is the same then don't add one, etc, it still does..

  • R0J0hound , okay here are some bugs..

    first example: object created inside on post collision doesn't get positioned. If you re-enable the joint action, it does for some reason.. weird. Also doesn't get pinned.

    [attachment=1:2rut6ghw][/attachment:2rut6ghw]

    second example: object created inside on post collision doesn't get pinned..

    [attachment=0:2rut6ghw][/attachment:2rut6ghw]

  • Thanks R0J0hound

  • Try Construct 3

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

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

    Download in first post.

    * Fixed: Adding joints in to new objects in "post collide"

    * Fixed: Movement actions for new objects in "post collide" were ignored.

    Prominent

    In "post collide" new objects aren't added to the simulation till right after the physics step. So they won't trigger a "post collide" till at least the next frame.

  • Update 2.2

    Download in first post.

    * Fixed: Adding joints in to new objects in "post collide"

    * Fixed: Movement actions for new objects in "post collide" were ignored.

    Prominent

    In "post collide" new objects aren't added to the simulation till right after the physics step. So they won't trigger a "post collide" till at least the next frame.

    Awesome! My game is working as expected now. Thanks a lot!

    If I come across anything else I'll let you know..

  • R0J0hound , Okay.. I think I found a bug.. Seems like when you move an object that a joint is attached to, the joint anchor position properties don't get updated until the next event cycle. So if you use the joint position expression right after moving the object, it won't be the accurate location.

  • Update 2.2a

    Download in first post.

    Fix: JointAnchor expressions were not giving the correct positions right away if objects were moved.

  • R0J0hound , the positions aren't accurate for sliding joints.

  • R0J0hound , actually, nevermind.. they're accurate.

    sliding joints have been confusing me for a while. I think it must be something with my events..

  • Slide joints should be like pin joints, but you specify a minimum and maximum distance instead of using the distance between anchor points.

  • hm, if I add a slide joint to two objects that are 10 pixels away from each other, and I give it a max distance of 10.. does that max distance get added onto the distance they're away from each other? Or does it take that into account already..

    That might be my confusion if it adds the distance onto the distance they're already from each other..

    edit: seems like it takes it into account. I'm still having trouble with sliding joints, not sure what my problem is though.. Must be something else I'm missing.

  • R0J0hound , when I try to set the idle speed threshold, I get this error

    ReferenceError: idleSpeedThreshold is not defined

    at Acts.setIdleSpeedThreshold (http://localhost:50000/rojoChipmunkBeta ... js:7673:35)

    at Action.run_object (http://localhost:50000/eveng.js:1839:10)

    at EventBlock.run_actions_and_subevents (http://localhost:50000/eveng.js:929:38)

    at EventBlock.run (http://localhost:50000/eveng.js:886:9)

    at Runtime.executeSingleTrigger (http://localhost:50000/preview.js:4565:10)

    at Runtime.triggerOnSheetForTypeName (http://localhost:50000/preview.js:4484:16)

    at Runtime.triggerOnSheet (http://localhost:50000/preview.js:4411:13)

    at Runtime.trigger (http://localhost:50000/preview.js:4393:12)

    at Layout.startRunning (http://localhost:50000/layout.js:379:16)

    at Runtime.go_loading_finished (http://localhost:50000/preview.js:1886:36)

  • Update 2.2b

    Download in first post.

    Fixed: "idle speed threshold" action was broken.

  • R0J0hound - the collisions in chipmunk seem more imprecise than c2's physics. I noticed the 'set fixed timestep' action defaults to 1/30, so does this mean the physics calculations are being done around every 2nd frame?

    The capx shows what i mean - the red box with chipmunk clips into the floor on collision then moves back up, while the c2 physics box just stops dead:

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