I've created a body for the player which consists of a large block and a smaller block for the foot sensor. Even though I can see the foot sensor touching the ground (I've made it bigger just to be sure), I don't get a BeginContact (I've also triend PreSolve and PostSolve) event for the sensor (I do get one for the solid part of the body, but when only the sensor is touching the ground, I get no event). This is my code:
this.listener.BeginContact = function (contact) {
var fixtureA = contact.GetFixtureA();
var fixtureB = contact.GetFixtureB();
var bodyA = fixtureA.GetBody().GetUserData(),
bodyB = fixtureB.GetBody().GetUserData();
console.log(contact.IsSensor(), fixtureA.IsSensor(), fixtureB.IsSensor(), fixtureA.GetUserData(), fixtureB.GetUserData());
if(fixtureA.IsSensor()){
bodyA.sensors[fixtureA.GetUserData()].active = true;
}
if(fixtureB.IsSensor()){
bodyB.sensors[fixtureB.GetUserData()].active = true;
}
};
The log prints: false, false, false, null, null (because only sensor fixtures have user data).
I've also tried making the body a bullet, like suggested in
What am I missing?