I'm trying to make it so that if the player or enemy is sitting on a platform and they want to drop down through it they can. I extended my own ContactFilter class so if you are holding down while contact with the platform is first made the player goes right through it but how would can I remove, in a sense, the contact with the platform that has already been established, allowing the player to pass through it?
Right now the relevant part of my ContactFilter looks like this
Again, this works if contact with the platform is first being established but not if the player is already on it and then the user decides they want to drop down. Any ideas?
Right now the relevant part of my ContactFilter looks like this
Code:
if (body1 is Character && body2.name == "Floor") {
if (body1.isMovingUp() || body1.isHoldingDown()) {
return false;
}
}
else if (body2 is Character && body1.name == "Floor") {
if (body2.isMovingUp() || body2.isHoldingDown()) {
return false;
}
}
if (body1.isMovingUp() || body1.isHoldingDown()) {
return false;
}
}
else if (body2 is Character && body1.name == "Floor") {
if (body2.isMovingUp() || body2.isHoldingDown()) {
return false;
}
}
Again, this works if contact with the platform is first being established but not if the player is already on it and then the user decides they want to drop down. Any ideas?