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.