Destroy Physics Joint

0 favourites
  • 6 posts
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • I modified the Physics plugin to add an action that destroys all Physics Joints. All is well until I get this error in the console, then it can't register any more joints as well as other weird behaviors.

    <font face="Courier New, Courier, mono">Uncaught TypeError: Cannot read property 'm_collideConnected' of undefined

            Physics_behavior.js:6523

        Box2D.Dynamics.b2World.DestroyJoint

            Physics_behavior.js:6523

        behinstProto.destroyMyJoints

            Physics_behavior.js:12158

        acts.destroyMyJoints

            Physics_behavior.js:12685

        actionProto.run_object

            eveng.js:1020

        eventblockProto.run_actions_and_subevents

            eveng.js:502

        eventblockProto.run_orblocktrigger

            eveng.js:490

        runtimeProto.triggerOnSheetForTypeName

            eveng.js:1963

        runtimeProto.triggerOnSheet

            eveng.js:1857

        runtimeProto.trigger

            eveng.js:1821

        instanceProto.onKeyDown

            Keyboard_plugin.js:88

        (anonymous function)

            Keyboard_plugin.js:54

        f.event.dispatch

            jquery-1.7.1.min.js:3

        f.event.add.h.handle.i

            jquery-1.7.1.min.js:3</font>

    I added this code to edittime.js

    <font face="Courier New, Courier, mono">AddAction(901, af_none, "Break joints", "Joints", "Break all {my} joints", "Break all physics joints on this object.", "destroyMyJoints");</font>

    And this code to runtime.js

    <font face="Courier New, Courier, mono">acts.destroyMyJoints = function () {

         this.destroyMyJoints();

    };</font>

    Here is the capx for the game the error occurred in.

    http://dl.dropbox.com/u/52788071/frisbee.capx

    The frisbee will "stick" to a pole when it hits it and spins around it until you either right-click or press space bar. You can control the frisbee while it's on a pole in any of three ways:

    • Click on the frisbee to push it.
    • Use the arrow keys to move it.
    • Hold down the left mouse button anywhere but the frisbee. A white ball will appear. Move the mouse to hit the frisbee with the ball. When you let go the ball will disappear.
  • You're probably not breaking other instance's references to that object's joints. I'll see if I can add that action officially anyway so you don't need to hack the behavior yourself.

  • Hey Ashley, would be possible to incorporate tags to joints when you create them to allow to selectively destroy them later?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, that would allow finer control... I'll see what I can do...

  • Thank you, Ashely

  • Sorry to necropost this suuuuuuuper old topoic . Ashley Do you think it's feasible to be able add tagging joints so we can destroy specific ones like mentioned above?

    If not I can use the workaround mentioned in the physics manual page. Thanks!

    [I saw this post when I was searching to see if this was possible. Which is why I necro'd rather than posting a new one]

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