setEnvironmentMap method

XRControllerModel setEnvironmentMap(
  1. Texture? envMap
)

Sets an environment map that is applied to the controller model.

@param {?Texture} envMap - The environment map to apply. @return {XRControllerModel} A reference to this instance.

Implementation

XRControllerModel setEnvironmentMap(Texture? envMap ) {
	if ( this.envMap == envMap ) {
		return this;
	}

	this.envMap = envMap;
	traverse( ( child ) {
		if ( child is Mesh ) {
			child.material!.envMap = this.envMap;
			child.material!.needsUpdate = true;
		}
	} );

	return this;
}