Quick answer: Discrete collision detection runs only once per fixed step. Fast objects skip past thin colliders between steps. Set the moving Rigidbody’s Collision Detection to Continuous Dynamic, lower fixed timestep slightly, and consider raycast-based hit detection for ultra-fast projectiles like bullets.
Here is how to fix Unity Rigidbody objects that pass right through walls when moving fast. Bullets clip the floor. Players moving 30 m/s phase through gates. The cause is a fundamental limitation of discrete collision detection: it only checks overlap at fixed-step boundaries, so fast objects can be on one side this step and the other side next step without the engine ever noticing they crossed a barrier.
The Symptom
A projectile or fast Rigidbody passes through a static collider as if nothing was there. OnCollisionEnter never fires. The wall is solid for slower objects. The thinner the wall (or the faster the object), the more likely the tunnel.
What Causes This
Discrete collision is per-step. Default detection mode samples positions at each FixedUpdate and checks for overlap. If the bullet was 1m left of the wall last step and 1m right of the wall this step, no overlap was sampled.
Thin colliders. A wall 0.05m thick fails collision detection at speeds where the per-step movement exceeds the wall thickness.
Long fixed timestep. Default 0.02s (50Hz physics) gives a 30 m/s object 0.6m per step. Walls thinner than 0.6m can be missed.
Bullet collision detection wrong. Setting Continuous Dynamic on the wall and Discrete on the bullet does nothing — the moving object needs the upgrade, not the static one.
The Fix
Step 1: Set Collision Detection to Continuous Dynamic on the moving Rigidbody.
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class Bullet : MonoBehaviour
{
[SerializeField] private float speed = 50f;
void Awake()
{
var rb = GetComponent<Rigidbody>();
rb.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
rb.interpolation = RigidbodyInterpolation.Interpolate;
rb.linearVelocity = transform.forward * speed;
}
}
Continuous Dynamic does a sweep-test along the path between fixed steps, catching collisions discrete mode would miss.
Step 2: Lower the fixed timestep. Open Edit → Project Settings → Time. Change Fixed Timestep from 0.02 to 0.01 (100Hz). Each step covers half the distance, halving the tunneling chance. Costs roughly 2x physics CPU.
Step 3: Use raycast-based hit detection for very fast projectiles.
public class RaycastBullet : MonoBehaviour
{
[SerializeField] private float speed = 200f;
private Vector3 lastPos;
void Start() { lastPos = transform.position; }
void Update()
{
Vector3 newPos = lastPos + transform.forward * speed * Time.deltaTime;
Vector3 dir = newPos - lastPos;
if (Physics.Raycast(lastPos, dir.normalized, out RaycastHit hit, dir.magnitude))
{
HandleHit(hit);
Destroy(gameObject);
}
else
{
transform.position = newPos;
lastPos = newPos;
}
}
}
For bullets and lasers, raycast is more reliable than physics and avoids the entire tunneling category.
Step 4: Thicken thin colliders. If a wall is meant to look thin but block fast objects, add an extra invisible collider with more depth behind it. Or set the wall’s collider Inflate Convex on a Mesh Collider to bulk it out.
Step 5: Avoid teleporting Rigidbodies via transform.position. Direct transform writes bypass physics and can cause objects to start a frame already inside a wall, where Continuous Dynamic cannot help. Use Rigidbody.MovePosition for kinematic teleports.
Performance Tradeoffs
Continuous Dynamic costs more CPU per Rigidbody than Discrete. Apply it only to the objects that need it: bullets, fast vehicles, falling debris. Slow-moving objects (NPCs, pickups) should stay on Discrete to save physics budget.
Verifying The Fix
Set physics.queriesHitBackfaces = true in code to see hits even on rear faces. Add a debug ray that draws the bullet’s path between frames; if the path crosses a collider but no hit is logged, your detection mode is still wrong.
Understanding the issue
Physics simulations rely on deterministic, frame-by-frame integration of forces and constraints. When a single step misbehaves, the consequences cascade through subsequent frames - velocities accumulate error, contacts re-solve, and what should have been a clean interaction becomes visible jitter or unbounded motion.
The specific bug described above is the kind that surfaces during integration rather than unit testing. It depends on a combination of factors: the asset configuration, the runtime state, the platform's specific behavior. In isolation, each piece looks correct; in combination, the bug emerges. This is why thorough integration testing - playing the actual game in realistic conditions - catches things that automated tests miss.
Why this happens
This bug class disproportionately affects late-stage development. The work to surface it is interactive testing in realistic conditions, which only really happens after the gameplay is in place and assets are populated. Catching it early requires deliberate testing of conditions that look unimportant.
At the engine level, the behavior comes from a deliberate design decision in Unity. The engine team chose a particular trade-off - usually performance versus convenience, or generality versus specificity - and that trade-off has consequences when you push against it. Understanding the trade-off is what turns 'this bug is mysterious' into 'this bug is the expected consequence of this design'.
Verifying the fix
Verifying this fix in isolation is straightforward: reproduce the bug, apply the change, confirm the bug no longer reproduces. The harder verification is regression - did this fix introduce a new bug elsewhere? Run your standard regression suite, plus any tests that exercise the same code path with different inputs.
Reproducibility is the prerequisite for verification. If you can't reliably reproduce the bug pre-fix, you can't reliably verify it post-fix. Spend time getting a clean reproduction before you write any fix code. The fix is fast once you understand the reproduction; the reproduction is the slow part.
Variations to watch for
Related bug classes often share the same root cause. If you find yourself fixing this issue, look for cousins: similar symptoms in adjacent systems, the same data flow but a different value, or the same fix pattern in another module. The catalog of 'we've seen this before' becomes valuable institutional knowledge.
Adjacent bugs often share a root cause. After fixing the case you've found, spend an hour searching the codebase for similar patterns. What's the same call with different arguments? The same data flow with a different entity type? The same lifecycle issue in a sibling system? Each match is a candidate for the same fix, or a related fix that prevents future bugs of the same class.
In production
For shipping titles with a long support window, watch for this issue resurfacing after dependency updates. Engine upgrades, driver updates, OS releases - each one can resurface a bug class you thought you'd fixed because the underlying behavior changed slightly. Regression tests catch the obvious ones; player reports catch the rest.
When triaging a similar issue in production, prioritize gathering data over hypothesizing causes. A player report describes a symptom; what you need is a build SHA, a session timestamp, and ideally a screen recording or session replay. With those, the bug becomes tractable. Without them, you're guessing at hypothetical reproductions that may not match what the player actually hit.
Performance considerations
If this issue manifests under high load (many actors, many particles, many network connections), profile the post-fix code path with realistic counts. The original cost was a bug; the new cost is real work, and real work has a budget.
Diagnostic approach
Diagnosing this class of bug benefits from a structured approach: confirm the symptom, isolate the variables, hypothesize the cause, and verify the hypothesis before writing fix code. Skipping the isolation step is the most common mistake; without it, fixes often address symptoms while the underlying cause continues to produce other variations.
For Unity-specific diagnostics, the editor's profiler is the canonical starting point. Capture a representative frame with the symptom present; compare against a frame without the symptom; the diff often points directly at the cause. If the symptom is non-deterministic, capture multiple frames and look for the pattern - the cause is usually a state transition or a specific input value rather than a continuous effect.
Tooling and ecosystem
Third-party plugins often provide better diagnostics for their own behavior than the engine does. If the affected code is in a plugin, check the plugin's documentation for debug modes, verbose logging, or inspector tools - these can save hours of investigation when they exist.
Within Unity, the relevant diagnostic surfaces include the standard frame debugger, memory profiler, and engine-specific debug overlays. Each one shows a different facet of what's happening. The frame debugger reveals draw call ordering and state transitions; the memory profiler shows allocation patterns; the debug overlay reveals per-system state. Bugs that resist one tool usually surrender to another - the trick is knowing which tool to reach for first.
Edge cases and pitfalls
Edge cases for this class of issue often involve specific timing: the first frame after a state change, the last frame before a transition, frames where multiple subsystems update simultaneously. Reproducing these reliably is part of what makes the bug class hard to test.
When writing a regression test for this fix, focus on the boundary conditions that surfaced the original bug. Tests that exercise the happy path catch obvious regressions; tests that exercise the boundary catch the subtler regressions that look like new bugs but are really the original returning. The latter are the tests that earn their keep over the long life of the project.
Team communication
When this bug class affects multiple teams (often the case for cross-system issues), early communication prevents duplicate work. The team that owns the symptom may not own the cause. A 15-minute conversation at the start of triage often saves hours of independent investigation.
If this fix touches a system several engineers work in, a short writeup in the team's engineering channel helps. Not a full design doc - a paragraph explaining what was wrong, what's fixed, and what to watch for. Future engineers encountering similar symptoms will search for the fix; making it findable is a small investment that pays back later.
“Discrete checks endpoints. Continuous checks the path. Fast objects need to check the path.”
Related Issues
For Rigidbody falling through floor, see Rigidbody Falling Through Floor. For mesh collider issues, see Mesh Collider Convex Required.
Continuous Dynamic on the moving body. Lower fixed step. Raycast for bullets. Walls become solid again.