- Home /
Objects falling through EdgeCollider2D on the ground
I have a 2D terrain generated using midpoint displacement, on which I also generate an EdgeCollider2D for the top edge. I then have a tank that can shoot a shell at a desired angle and power.
The shell has a Rigidbody2D and a CircleCollider2D with a radius of 0.1 and is set as a trigger. When it hits a collider, the shell is destroyed by script. The shell is fired by adding force, I am not manually editing transforms or anything.
Normally, it'll hit the ground and be destroyed just fine. However, occasionally, if it hits in just the right place, it goes right through the collider on the ground. Once I find one of these spots, if I continue firing without adjusting the angle or power, it will go through the collider every time. If I adjust either the angle or power by even the tiniest amount, it will hit again.
I know that fast moving objects can go through colliders. I understand that setting the Collision Detection on the Rigidbody2D of the shell to Continuous is supposed to prevent this, however that has no effect, so I'm not sure if the cause of the issue is something else, or if Continuous is simply not working.
I have tried increasing the radius of the CircleCollider2D on the shell, as well as setting Fixed Timestep to 0.01 and Maximum Allowed Timestep to 0.1666 in the Time Manager. These both helped reduce the frequency of the issue, however they did not completely prevent it.
What else could be causing this issue? If it is indeed simply because the shell is too small and moving too fast, why isn't Continuous Collision Detection fixing it?