- Home /
2d rigidbody falling from the collider when it is moved
I have a box made of four rectangles. A 2D box collider is attached to each of the square. The box rotates in both the directions upon receiving the commands. The square inside the box has a rigidbody attached to it. The square rests on the box when pressed play however when I am rotating the box, the square jumps down the box and keep going down. Please suggest a resolution for it. Below is a screenshot.
After rotating the box
Answer by megastacks_13 · Feb 13, 2020 at 09:16 AM
@shakti_patra You will probably need to add a single collider to each of the rectangles that form the big square because if you put a single collider, it will fall. I think this is the solution, tell me if it works :)
Answer by shakti_patra · Feb 13, 2020 at 09:26 AM
Thank you for the response however I am already using individual 2D box colliders for the sides and facing this issue. I also tried using single polygon collider however still facing the same issue. I tried decreasing the rotation speed of the box and issue was fixed but my game requires high rotation speed. Any help is highly appreciated..
Do you have the collision detection in continous? It show in discrete by default I think that is in the rigidbody componernt
I have tried with both continuous and discrete but the results are same.. issue persists.. i think it has to be something with the rotation speed.
The discrete collision detection, is checking a collider every frame, so if you go to quick, it won't detect the collider and fall, the continous detection, detects the collider all the time. Waiting fon an answer
Answer by Merivo · May 25 at 11:03 PM
I know this is a necropost but I had this issue and found a solution. Give it both a box collider and a slightly smaller circle collider. Due to how circle colliders work they almost never fall through other colliders. Making it slightly smaller also means the box collider behaviour gets priority.