Capítulo 134 de 859

Chapter 134: PointLightHelper

Core Idea

This displays a helper object consisting of a spherical mesh for visualizing an instance of PointLight.

Key Concepts

  • color : number | Color | string: The color parameter passed in the constructor. If not set, the helper will take the color of the light.
  • light : PointLight: The light being visualized.

Code Examples

const pointLight = new THREE.PointLight( 0xff0000, 1, 100 );
pointLight.position.set( 10, 10, 10 );
scene.add( pointLight );
const sphereSize = 1;
const pointLightHelper = new THREE.PointLightHelper( pointLight, sphereSize );
scene.add( pointLightHelper );
  • What it demonstrates: Typical usage of PointLightHelper.

Reference Tables

Constructor

Signature
`new PointLightHelper( light : PointLight, sphereSize : number, color : number

Properties

PropertyDescription
`.color : numberColor
.light : PointLightThe light being visualized.

Methods

MethodDescription
.dispose()Frees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
.update()Updates the helper to match the position of the light being visualized.

Key Takeaways

  1. PointLightHelper extends: EventDispatcher → Object3D → Mesh
  2. Most relevant properties: color, light.
  3. Key methods: dispose, update.

Connects To