- Home /
Question by
MolochSim · Nov 09, 2014 at 12:07 AM ·
2d-platformerphysics2d
How to have the character fall when disabling collisions with layer its currently on?
I am making a 2D platformer, where there is a way to change the layout of the level and I am putting the affectible platforms in different layers - disable one and enable the other using Physics2D.IgnoreLayerCollision. But when the character stands on a platform and the visible/colliding layer is changed, the character stays in air until moved.
How do I make this character fall after the platform "disapears"?
The layer is also removed in the camera mask and in the part of my code that checks for ground. I dont want my character standing in mid-air.
Comment
Best Answer
Answer by 767_2 · Nov 11, 2014 at 06:04 PM
reenable the collider on your object
public GameObject character;
void ignoreColl()
{
Physics2D.IgnoreLayerCollision(1, 31,true);
character.collider2D.enabled = false;
character.collider2D.enabled = true;
}