Checking collisions on each edge?
Posted: Tue May 01, 2012 6:23 pm
Increasingly, I'm finding that the physics module does not follow box2d as closely as it claims . For instance, in a platformer with Box2Djs, I could check if the player is on the floor using:
But the physics module has neither contact lists nor world manifolds, so I have no idea how to do this in love2d. Could anyone help me?
Code: Select all
player.onFloor = function()
{
var edge;
for (edge = this.body.GetContactList(); edge != null; edge = edge.next)
{
var a = new b2WorldManifold();
edge.contact.GetWorldManifold(a);
if(edge.contact.IsTouching() && a.m_normal.y > 0.7)
{
if(edge.contact.GetFixtureA().GetUserData().type == "player")
return true;
}
};
return false;
};