Hi -
I'm using the code below to return which body has been touched by the mouse
if (!Input.mouseDown && Input.isKeyPressed(68/*D*/)){
var aabb:b2AABB = new b2AABB();
aabb.lowerBound.Set((Input.mouseX-1.0)/30, (Input.mouseY-1.0)/30);
aabb.upperBound.Set((Input.mouseX+1.0)/30, (Input.mouseY+1.0)/30);
// Query the world for overlapping shapes.
var k_maxCount:int = 1;
var shapes:Array = new Array();
var count:int = m_world.Query(aabb, shapes, k_maxCount);
for(var i:int = 0; i < count; ++i){
m_world.DestroyBody(shapes{i}.m_body);
}
}
all of the bodys are basically lines (polygons with 2 vertices).
The code works fine, but what I want to know is exactly where on the body the b2AABB has intersected.
Diagram below:

I want to get 4 new x and y to create two new bodys.
So the result would be two bodies instead of one like you are deleting a part of the body and not the whole body.
Any ideas??
- M
I'm using the code below to return which body has been touched by the mouse
if (!Input.mouseDown && Input.isKeyPressed(68/*D*/)){
var aabb:b2AABB = new b2AABB();
aabb.lowerBound.Set((Input.mouseX-1.0)/30, (Input.mouseY-1.0)/30);
aabb.upperBound.Set((Input.mouseX+1.0)/30, (Input.mouseY+1.0)/30);
// Query the world for overlapping shapes.
var k_maxCount:int = 1;
var shapes:Array = new Array();
var count:int = m_world.Query(aabb, shapes, k_maxCount);
for(var i:int = 0; i < count; ++i){
m_world.DestroyBody(shapes{i}.m_body);
}
}
all of the bodys are basically lines (polygons with 2 vertices).
The code works fine, but what I want to know is exactly where on the body the b2AABB has intersected.
Diagram below:

I want to get 4 new x and y to create two new bodys.
So the result would be two bodies instead of one like you are deleting a part of the body and not the whole body.
Any ideas??
- M



