hey! so i have created AABB-AABB collision detection:
var lenX:Number = Math.abs(obj.x - (x+vx));
var totalRadiusX:Number = obj.hx + hx;
var lenY:Number = Math.abs(obj.y - (y+vy));
var totalRadiusY:Number = obj.hy + hy;
if (totalRadiusX > lenX && totalRadiusY > lenY)
{
var penX:Number = totalRadiusX - lenX;
var dx:Number = utils.Sign(x + vx - obj.x);
var penY:Number = totalRadiusY - lenY;
var dy:Number = utils.Sign(y+vy-obj.y);
if (Math.abs(penX) > Math.abs(penY))
{
y += vy + penY * dy;
vy = 0;
}
else if (Math.abs(penX) < Math.abs(penY))
{
x += vx + penX * dx;
vx = 0;
}
}
**Metanet tut where 2 AABB collides have the same problem **http://www.metanetsoftware.com/technique/tutorialA.html#section1
But the thing is it doesnt recognize corners.(because of test of which overlap is smaller but if there isn’t such code then it works even worse) What should i do and is this even good method or is there better? It would be cool if someone could provide me with some tutorials(
except metanet because i am kinda working from their tuts).