← Back to Documentation Index

⚛️ Physics Engine

Simple physics simulation with gravity, velocity, and forces

📋 Overview

The Physics Engine provides basic 2D/3D physics simulation including gravity, velocity, acceleration, and force application perfect for platformers and arcade games.

💡 Key Features
  • Gravity - Automatic downward force
  • Velocity - Object movement with speed and direction
  • Acceleration - Force-based movement
  • Particle Systems - Efficient multi-object physics

⚛️ Physics Functions

applyGravity(object, gravity)

Applies gravity force to an object.

object object - Object with velocityY property
gravity number - Gravity strength (e.g., 0.5)
Returns: void - No return value
Example:
applyGravity(player, 0.8);
updateVelocity(object)

Updates object position based on velocity.

object object - Object with x, y, velocityX, velocityY
Returns: void - No return value
Example:
updateVelocity(player);