End contact doesn't fire when an object is destroyed? Could I force it to?
End contact doesn't fire?
WCKOmg, you know you're fucked when the port maintainer ignores your topics. 3:>
ha ha what? End contact should definitely fire when an object is destroyed. Can you provide a test bed showing this is not the case?
Hmm, I guess I'll look at it a little better. I'm trying to destroy an object while you're dragging it around with allowdragging=true. But if it's destoried then I get a joint error.
Thinking the answer the obviosly because you can't destroy a jointed object. I decided to make it invisible and a sensor when the player removed it(and add to the score and stuff) and actually remove it on the next mouse up event.
Does any of that sound like it would cause that error?
Thinking the answer the obviosly because you can't destroy a jointed object. I decided to make it invisible and a sensor when the player removed it(and add to the score and stuff) and actually remove it on the next mouse up event.
Does any of that sound like it would cause that error?
What is the specific error and stack trace you are getting? You should be able to destroy a body attached to any joint (including a mouse joint). Joints listen for their body's remove events and know they should get removed when the body is destroyed.
Maybe it's trying to update the joint after it's been destroyed with the new mouse position? I'll give it a test when I've got some time.
Maybe it's trying to update the joint after it's been destroyed with the new mouse position? I'll give it a test when I've got some time.
Ok, so when I remove a body attached with the allowDragging mouse joint I get this:
I assume that's the problem anyways. I really have no clue what that means.
Code:
TypeError: Error #1006: value is not a function.
at cmodule.Box2D::FSM__ZN7b2World12DestroyJointEP7b2Joint/work()
at <anonymous>()
at <anonymous>()
at Box2DAS.Dynamics.Joints::b2Joint/destroy()[C:\Documents and Settings\Administrator\My Documents\Dropbox\Jems\Engine\Box2DAS\Dynamics\Joints\b2Joint.as:32]
at <anonymous>()[C:\Documents and Settings\Administrator\My Documents\Dropbox\Jems\Engine\wck\Joint.as:614]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at wck::World/step()[C:\Documents and Settings\Administrator\My Documents\Dropbox\Jems\Engine\wck\World.as:193]
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at <anonymous>()[C:\Documents and Settings\Administrator\My Documents\Dropbox\Jems\Engine\wck\BodyShape.as:1337]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at wck::World/step()[C:\Documents and Settings\Administrator\My Documents\Dropbox\Jems\Engine\wck\World.as:193]
at cmodule.Box2D::FSM__ZN7b2World12DestroyJointEP7b2Joint/work()
at <anonymous>()
at <anonymous>()
at Box2DAS.Dynamics.Joints::b2Joint/destroy()[C:\Documents and Settings\Administrator\My Documents\Dropbox\Jems\Engine\Box2DAS\Dynamics\Joints\b2Joint.as:32]
at <anonymous>()[C:\Documents and Settings\Administrator\My Documents\Dropbox\Jems\Engine\wck\Joint.as:614]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at wck::World/step()[C:\Documents and Settings\Administrator\My Documents\Dropbox\Jems\Engine\wck\World.as:193]
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at <anonymous>()[C:\Documents and Settings\Administrator\My Documents\Dropbox\Jems\Engine\wck\BodyShape.as:1337]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at wck::World/step()[C:\Documents and Settings\Administrator\My Documents\Dropbox\Jems\Engine\wck\World.as:193]
I assume that's the problem anyways. I really have no clue what that means.
I am getting a #1009 after removing a body as well. I am using removeChild() (as I've seen mayobutter recommend so many times). I've also tried removing the child outside the time step to no avail. Any ideas?
Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at misc::Util$/localizeMatrix()[/source/misc/Util.as:210]
at wck::BodyShape/syncTransform()[/source/wck/BodyShape.as:1302]
at wck::BodyShape/updateTween()[/source/wck/BodyShape.as:1322]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at Box2DAS.Common::b2EventDispatcher/dispatchEvent()[/source/Box2DAS/Common/b2EventDispatcher.as:27]
at Box2DAS.Dynamics::b2World/Step()[/source/Box2DAS/Dynamics/b2World.as:158]
at wck::World/step()[/source/wck/World.as:194]
at misc::Util$/localizeMatrix()[/source/misc/Util.as:210]
at wck::BodyShape/syncTransform()[/source/wck/BodyShape.as:1302]
at wck::BodyShape/updateTween()[/source/wck/BodyShape.as:1322]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at Box2DAS.Common::b2EventDispatcher/dispatchEvent()[/source/Box2DAS/Common/b2EventDispatcher.as:27]
at Box2DAS.Dynamics::b2World/Step()[/source/Box2DAS/Dynamics/b2World.as:158]
at wck::World/step()[/source/wck/World.as:194]
I just committed a fix for removing bodies that are currently being dragged. The problem was that after the mouse joint was removed the world would still try to update it.
Original thread: https://box2d.org/forum/viewtopic.php?t=6969