New answers tagged resolution
0
I fixed the problem by putting a normalized normal into the m.Normal field and multiplied it by a value to flip the normal depending on what axis/axes it was intersecting on.
public static bool TestAABBvsAABB (AABB a, AABB b, ref Manifold m)
{
m.A = a;
m.B = b;
m.Normal = b.Position - a.Position;
...
2
I believe that your manifold normals are incorrect. These AABBs will attempt to "push back" along the axis of the greatest intersection, however:
if(m.Normal.X < 0)
m.Normal = new Vector2(-1,0);
else
m.Normal= Vector2.Zero;
That code is saying "if B is further left than A, then the direction to resolve penetration is in the negative X axis, ...
Top 50 recent answers are included