Physics Part 2

Download

Unity Cheat Sheet: #22

Abhishek Smith

Abhishek Smith

Building Outscal | Land Jobs in the gaming industry | EA, Epic Games, TCS, | CMU, IIT K

Unity's Physics isn't just about making things fall. It's a complete simulation system that handles forces, collisions, materials, and joints - just like the real world. Here's what's actually happening under the hood:

Forces & Motion

  • AddForce: Push objects (like rocket thrust)
  • AddTorque: Spin objects (like a turning wheel)
  • ForceMode.Force: Continuous push (engine)
  • ForceMode.Impulse: Instant force (explosion)

Physics Materials

  • Bounciness: How much objects bounce back
  • FrictionCombine: How surfaces interact
  • Material assignment to colliders
  • Custom material properties

Collision Detection

  • Raycasts: Shoot invisible lines to detect objects
  • OverlapSphere: Find objects in radius
  • LayerMasks: Filter what can collide
  • Continuous detection for fast objects

Rigidbody States

  • Kinematic: Full script control, ignores forces
  • Dynamic: Responds to physics forces
  • Sleep/WakeUp: Optimize inactive objects
  • Interpolation: Smooth movement

Physics Optimization

  • Layer collision matrix
  • Sleep states for static objects
  • Continuous vs Discrete collision
  • Physics.autoSimulation control

Common Uses:

  • Projectiles: AddForce + Raycast
  • Character: Kinematic Rigidbody
  • Vehicles: WheelJoint + AddTorque
  • Ragdolls: Multiple connected Rigidbodies

Key Point: Physics is expensive. Every rigidbody, every collision check, every force calculation costs CPU time. Use wisely.

Show More