

Have you ever shot a bullet, thrown a fast ball, or moved a car quickly in Unity, only to see it pass right through a wall or floor? This frustrating behavior is called tunneling.
It’s a common problem for fast-moving Rigidbody objects. Understanding why it happens and how to fix it is critical for any physics-heavy game.
Unity physics runs in fixed steps. By default, FixedUpdate runs every 0.02 seconds (50 Hz). During each step, Unity calculates collisions between positions.
If an object moves too far in a single physics step, it may skip over a collider entirely. The physics engine never detects the collision → the object “tunnels” through.
Think of it as taking big leaps over small obstacles instead of touching them.
Rigidbody has a Collision Detection setting. By default, it is set to Discrete, which is fast but can miss collisions.
Change it to:
Rigidbody rb = GetComponent<Rigidbody>(); rb.collisionDetectionMode = CollisionDetectionMode.Continuous;
This instructs Unity to perform extra checks and prevent tunneling.
Unity physics runs at a fixed interval. Faster updates reduce tunneling.
Default Fixed Timestep = 0.02 (50 FPS)
Consider reducing to 0.01 (100 FPS) in Edit → Project Settings → Time.
Thin walls or floors are easier to miss. Increasing thickness reduces the chance of tunneling.
If your object is moving extremely fast, even continuous collision detection can fail.
Clamp the maximum velocity:
Vector3 velocity = rb.velocity;
float maxSpeed = 50f;
if (velocity.magnitude > maxSpeed)
{
rb.velocity = velocity.normalized * maxSpeed;
}
For bullets or projectiles, sometimes physics alone isn’t enough. Use a raycast to detect collisions manually between frames.
RaycastHit hit;
Vector3 move = rb.velocity * Time.fixedDeltaTime;
if (Physics.Raycast(transform.position, rb.velocity.normalized, out hit, move.magnitude))
{
transform.position = hit.point;
// Handle collision manually
}
else
{
rb.MovePosition(transform.position + move);
}
This guarantees detection even for extreme speeds.
Tunneling is not a bug—it is a consequence of discrete physics simulation. Understanding how Unity performs collision detection allows you to prevent objects from passing through walls while keeping your game performant.
By combining Continuous collision detection, careful timestep settings, proper collider sizing, and raycasting when needed, you can handle fast-moving objects reliably and avoid tunneling in your games.