Firstly please excuse my newbieness.
I have been playing around with Box2D for a little while now and it is slowly starting to make sense. Just wondering if someone could give me a nudge in the right direction with this.
I am just trying to remove a body which has a graphic attached to it via bodyDef.userData
I am trying to achieve this when the body is clicked upon using a GetBodyAtMouse function.
Here is what I have so far:
Which appears to remove the body but does not remove the attached graphic.
What am I missing? Some kind of removeChild call to remove it from the display list? If so, how do I reference the attached graphic?
I have read the manual but this is a pretty steep learning curve for me and not all of it makes to me sense just yet.
Any help greatly appreciated!
thanks
I have been playing around with Box2D for a little while now and it is slowly starting to make sense. Just wondering if someone could give me a nudge in the right direction with this.
I am just trying to remove a body which has a graphic attached to it via bodyDef.userData
I am trying to achieve this when the body is clicked upon using a GetBodyAtMouse function.
Here is what I have so far:
Code:
public function on_mouse_down(evt:MouseEvent):void {
var body:b2Body = GetBodyAtMouse();
m_world.DestroyBody(body);
body = null;
}
var body:b2Body = GetBodyAtMouse();
m_world.DestroyBody(body);
body = null;
}
Which appears to remove the body but does not remove the attached graphic.
What am I missing? Some kind of removeChild call to remove it from the display list? If so, how do I reference the attached graphic?
I have read the manual but this is a pretty steep learning curve for me and not all of it makes to me sense just yet.
Any help greatly appreciated!
thanks