Capítulo 305 de 859

Chapter 305: PositionalAudioHelper

Core Idea

This helper displays the directional cone of a positional audio.

PositionalAudioHelper must be added as a child of the positional audio.

Key Concepts

  • audio : PositionalAudio: The audio to visualize.
  • divisionsInnerAngle : number: The number of divisions of the inner part of the directional cone.
  • divisionsOuterAngle : number: The number of divisions of the outer part of the directional cone.
  • range : number: The range of the directional cone.

Code Examples

const positionalAudio = new THREE.PositionalAudio( listener );
positionalAudio.setDirectionalCone( 180, 230, 0.1 );
scene.add( positionalAudio );
const helper = new PositionalAudioHelper( positionalAudio );
positionalAudio.add( helper );
  • What it demonstrates: Typical usage of PositionalAudioHelper.

Reference Tables

Constructor

Signature
new PositionalAudioHelper( audio : PositionalAudio, range : number, divisionsInnerAngle : number, divisionsOuterAngle : number )

Properties

PropertyDescription
.audio : PositionalAudioThe audio to visualize.
.divisionsInnerAngle : numberThe number of divisions of the inner part of the directional cone.
.divisionsOuterAngle : numberThe number of divisions of the outer part of the directional cone.
.range : numberThe range of the directional cone.

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. This method must be called whenever the directional cone of the positional audio is changed.

Key Takeaways

  1. PositionalAudioHelper extends: EventDispatcher → Object3D → Line
  2. Most relevant properties: audio, divisionsInnerAngle, divisionsOuterAngle, range.
  3. Key methods: dispose, update.

Connects To