src/core/World.js
/**
	* Creates the player instance.
	*
	* @return {World} A reference to this world object.
	*/
Creates the player instance.
@return {World} A reference to this world object.
Creates the player instance . @return { World } A reference to this world object .
_initPlayer() {
		const assetManager = this.assetManager;
		const player = new Player( this );
		const body = new Object3D(); 
		body.matrixAutoUpdate = false;
		player.setRenderComponent( body, sync );
		const step1 = assetManager.cloneAudio( assetManager.audios.get( 'step1' ) );
		const step2 = assetManager.cloneAudio( assetManager.audios.get( 'step2' ) );
		const impact1 = assetManager.audios.get( 'impact1' );
		const impact2 = assetManager.audios.get( 'impact2' );
		const impact3 = assetManager.audios.get( 'impact3' );
		const impact4 = assetManager.audios.get( 'impact4' );
		const impact5 = assetManager.audios.get( 'impact5' );
		const impact6 = assetManager.audios.get( 'impact6' );
		const impact7 = assetManager.audios.get( 'impact7' );
		step1.setVolume( 0.5 );
		step2.setVolume( 0.5 );
		body.add( step1, step2 );
		body.add( impact1, impact2, impact3, impact4, impact5, impact6, impact7 );
		player.audios.set( 'step1', step1 );
		player.audios.set( 'step2', step2 );
		player.audios.set( 'impact1', impact1 );
		player.audios.set( 'impact2', impact2 );
		player.audios.set( 'impact3', impact3 );
		player.audios.set( 'impact4', impact4 );
		player.audios.set( 'impact5', impact5 );
		player.audios.set( 'impact6', impact6 );
		player.audios.set( 'impact7', impact7 );
		const mixer = new AnimationMixer( player.head );
		const deathClip = this.assetManager.animations.get( 'player_death' );
		const clips = [ deathClip ];
		player.setAnimations( mixer, clips );
		this.add( player );
		this.competitors.push( player );
		this.spawningManager.respawnCompetitor( player );
		if ( this.debug ) {
			player.deactivate();
		}
		this.player = player;
		return this;
	}
_initPlayer ( ) { const assetManager = this . assetManager ; const player = new Player ( this ) ; const body = new Object3D ( ) ; body . matrixAutoUpdate = false ; player . setRenderComponent ( body , sync ) ; const step1 = assetManager . cloneAudio ( assetManager . audios . get ( 'step1' ) ) ; const step2 = assetManager . cloneAudio ( assetManager . audios . get ( 'step2' ) ) ; const impact1 = assetManager . audios . get ( 'impact1' ) ; const impact2 = assetManager . audios . get ( 'impact2' ) ; const impact3 = assetManager . audios . get ( 'impact3' ) ; const impact4 = assetManager . audios . get ( 'impact4' ) ; const impact5 = assetManager . audios . get ( 'impact5' ) ; const impact6 = assetManager . audios . get ( 'impact6' ) ; const impact7 = assetManager . audios . get ( 'impact7' ) ; step1 . setVolume ( 0.5 ) ; step2 . setVolume ( 0.5 ) ; body . add ( step1 , step2 ) ; body . add ( impact1 , impact2 , impact3 , impact4 , impact5 , impact6 , impact7 ) ; player . audios . set ( 'step1' , step1 ) ; player . audios . set ( 'step2' , step2 ) ; player . audios . set ( 'impact1' , impact1 ) ; player . audios . set ( 'impact2' , impact2 ) ; player . audios . set ( 'impact3' , impact3 ) ; player . audios . set ( 'impact4' , impact4 ) ; player . audios . set ( 'impact5' , impact5 ) ; player . audios . set ( 'impact6' , impact6 ) ; player . audios . set ( 'impact7' , impact7 ) ; const mixer = new AnimationMixer ( player . head ) ; const deathClip = this . assetManager . animations . get ( 'player_death' ) ; const clips = [ deathClip ] ; player . setAnimations ( mixer , clips ) ; this . add ( player ) ; this . competitors . push ( player ) ; this . spawningManager . respawnCompetitor ( player ) ; if ( this . debug ) { player . deactivate ( ) ; } this . player = player ; return this ; }
Creates the player instance.
Creates the player instance .
// render component // dummy 3D object for adding spatial audios // audio // the following audios are unique and will be used only for the player (no cloning needed) // animation // add the player to the world // in dev mode we start with orbit controls //