Skip to main content
Creates Three.js lights from MJCF <light> elements in the loaded model. Hook form of <SceneLights> for imperative usage inside your own components.

Signature

Usage

Composing with Custom Lighting

Parameters

Light Mapping

How It Works

  1. On model load, reads model.nlight and iterates all MJCF light definitions
  2. Creates DirectionalLight or SpotLight instances based on light_type
  3. Applies position, direction, color, shadow, and attenuation from model data
  4. Lights are added to the R3F scene and cleaned up on unmount or model change

Notes

  • For a declarative JSX API, use <SceneLights> instead
  • The component form is a thin wrapper around this hook
  • If the MJCF model has no <light> elements, this hook does nothing