2

I'm trying to import the PositionalAudioHelper. The code is very basic:

// create the PositionalAudio object (passing in the listener)
import * as THREE from 'three';

var sound = new THREE.PositionalAudio( listener );
var helper = new THREE.PositionalAudioHelper(sound);
sound.add( helper );

The webpack error I get is:

"export 'PositionalAudioHelper' (imported as 'THREE') was not found in 'three'

I installed Three using yarn so it may not install the latest version that includes this commit: https://github.com/mrdoob/three.js/pull/15748

Any ideas on how to do this?

gman
  • 100,619
  • 31
  • 269
  • 393
firebait
  • 473
  • 1
  • 4
  • 7

1 Answers1

2

Since PositionalAudioHelper is located on the examples directoy, you have to import it like so:

import { PositionalAudioHelper } from 'three/examples/jsm/helpers/PositionalAudioHelper.js';

three.js R116

Mugen87
  • 28,829
  • 4
  • 27
  • 50