PHYSICS ENGINE • PHYSX
Unity Rigidbody Not Moving or Falling Through Floor
Fix physics glitches where objects ignore forces, drop straight through terrain, or freeze in place unexpectedly.
⚠️ Severity: Medium
⚙️ PhysX Simulation
⏱️ 5 Min Fix
1
Verified Physics Force Execution Script
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class ProperRigidbodyPush : MonoBehaviour
{
private Rigidbody rb;
private void Awake()
{
rb = GetComponent<Rigidbody>();
// 1. Ensure kinematic is FALSE so physics can move it
rb.isKinematic = false;
// 2. Set Continuous Speculative or Continuous to prevent floor tunneling
rb.collisionDetectionMode = CollisionDetectionMode.Continuous;
// 3. Interpolate for jitter-free movement
rb.interpolation = RigidbodyInterpolation.Interpolate;
}
private void FixedUpdate()
{
// ALWAYS use FixedUpdate for Rigidbody forces!
if (Input.GetKey(KeyCode.Space))
{
// Use ForceMode.VelocityChange or Impulse to overcome mass reliably
rb.AddForce(Vector3.up * 8f, ForceMode.VelocityChange);
}
}
}
Understanding Unity Rigidbody Physics Sleep and PhysX Simulation
To optimize performance, Unity PhysX automatically puts stationary Rigidbodies into a dormant Sleep State. If an object remains motionless for several seconds, PhysX stops computing physics for it until an external force, impulse, or dynamic collision wakes it up.
How to Wake Up Sleeping Rigidbodies
If your script attempts to apply velocity to an object that has gone to sleep, explicitly call rb.WakeUp() before applying forces:
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class PhysicsActivator : MonoBehaviour
{
private Rigidbody rb;
private void Awake()
{
rb = GetComponent<Rigidbody>();
}
public void LaunchMissile(Vector3 direction, float forceMagnitude)
{
if (rb.IsSleeping())
{
rb.WakeUp();
}
rb.AddForce(direction * forceMagnitude, ForceMode.Impulse);
}
}
Drag vs Angular Drag Configuration
Excessive Drag (linear damping) or Angular Drag (rotational damping) can make an object feel heavy and completely unresponsive to motor forces. For arcade flight vehicles, start with a linear drag of 0.05 and an angular drag of 0.1, tweaking upward only to stabilize excessive drift.