Disabling collision between two Physics 2.0 objects

Hi all, I want to disable collision between a ball and a cube which are both Physics 2.0 objects when the ball is within a region. I tried setting ‘Enable Layer’ to no for the ball when it is within the region but that doesn’t work at all. How can I get it to work? Thanks in advance.

I think you can enable/disable behaviors from a simple action. I didn’t try it with the physics, but it’s work with the drag and drop behavior.
and I think you can check the distance between two object in a simple condition.
look around what tools are available.

1 Like

Changing the layer won’t change anything as the physics engine is completely separated from the rest of the engine. Basically, the engine tells the physics engine when a new object is created and gives him a collision mask, then feed it with the x and y positions and angle and the physics engine does his calculation then sends the new x and y and angle for the object.

1 Like

Thank you all for answering. I have managed to do what I wanted. Basically, what I wanted to do is to have an invisible box which is always at the touch position be not able to “kick” a ball when it is within a goalpost(it’s a football game). I managed to do that by checking if the touch position is inside the collision mask of the goalpost and if it is, the box is teleported to the origin. At first I did something different and it did not work which is why I decided to proceed by disabling the ball’s collision when it is within the goalpost. It works as intended now. Thanks again for answering!

2 Likes