- Home /
Physics2D.IgnoreLayerCollision only on enter?
Since Physics2D doesn't have specific IgnoreCollision yet I put my two rigidbodies that need to be able to toggle back and forth between colliding or not in two different layers.
The collision should be deactivated if the second RigidBody is close to stationary or if the first is carrying the second.
I can make this sort of work, but it glitches. Sometime the first stays on top of the other. Some times the second propels the first across the screen. I've figured out it may be that the IgnoreLayerCollision is only "OnEnter" and not "OnStay".
A simple way to test the behavoiur is to put the game on play and then put one ridigbody on top of the other with collision on. Then manually deactivated the collision between the layers (Edit > Project Settings > Physics 2D) and the two ridgidbodies stay on top of each other.
Is there a reasonable way of handling this? Is my guess right? Do I have to make sure the two re-collide when switching between collision modes by applying some minor forces to the two?
Your answer
Follow this Question
Related Questions
Trouble Descaling 2D object 1 Answer
2D Detect collisions of a 2D block only on left/right (not top/bottom) 0 Answers
Ignore collision at high velocity. 1 Answer
Change shape of object upon collision 1 Answer
Colliders in a wall jut out 0 Answers