Skip to content

Variable: PhysicsBody

const PhysicsBody: Component<{ _angularVelocity: { default: [number, number, number]; type: Vec3; }; _engineBody: { default: number; type: Float64; }; _engineOffset: { default: number; type: Float64; }; _linearVelocity: { default: [number, number, number]; type: Vec3; }; gravityFactor: { default: number; type: Float32; }; linearDamping: { default: number; type: Float32; }; state: { default: "DYNAMIC"; enum: { Dynamic: "DYNAMIC"; Kinematic: "KINEMATIC"; Static: "STATIC"; }; type: Enum; }; }>

Defined in: packages/core/src/physics/physicsBody.ts:46

Component for physics bodies. A physics body is a virtual object that represents a physical object in a simulation.

Remarks

  • Static bodies are used for immovable objects like walls and floors.
  • Dynamic bodies respond to forces, collisions, and gravity.
  • Kinematic bodies can be moved programmatically but don't respond to physics forces.
  • Internal properties like _engineBody are managed automatically by PhysicsSystem.

Example

ts
entity.addComponent(PhysicsBody, {
  state: PhysicsState.Dynamic
})

See