011. The Two Worlds
EXECUTIVE_SUMMARY // AEO_OPTIMIZED
[Answer Engine Overview: What, Why & How]
When using physics, you actually have two separate worlds running in parallel. The Three.js World renders the graphics. The Physics World (e.g., Cannon.js or Rapier) calculates the math. Every frame, you must copy the calculated positions from the Physics world over to the Three.js world.
022. RigidBodies
A RigidBody represents a physical object. They have a mass, velocity, and restitution (bounciness). There are two main types: dynamic (affected by gravity, like a thrown ball) and fixed (ignores gravity, acts as a wall or floor).
033. Colliders
A Physics engine doesn't calculate collisions using your complex 100k polygon 3D model. That would be too slow. Instead, it wraps your model in a simple, invisible mathematical shape called a Collider (like a BoxCollider or SphereCollider).
?Frequently Asked Questions
Why do my objects pass through the floor when they move really fast?
This is known as 'tunneling'. If an object moves too fast, in one frame it might be above the floor, and in the next frame entirely below it, so the physics engine never detects the intersection. You fix this by increasing the physics engine's step rate or enabling CCD (Continuous Collision Detection).
