PM_ThreeVisible

PM_ThreeVisible

Provides a pawn with an interface to the Three.js renderer. Visible pawns should set their three.js render objects when they are created. The three.js render object will then automatically track the pawn's position within the scene.

Note: In order to work properly the PM_ThreeVisible mixin should be combined with PM_Spatial or one of its descendants. Listens to event:viewGlobalChanged to update the transform in the draw call.

Methods

# setRenderObject(renderObject)

Adds a three.js render object to the pawn. The render object will have its transform automatically updated when the pawn moves.

Parameters:
Name Type Description
renderObject Object

A three.js render object.

Example
this.geometry = new THREE.BoxGeometry( 1, 1, 1 );
this.material = new THREE.MeshStandardMaterial();
const cube = new THREE.Mesh( this.geometry, this.material );
this.setRenderObject(cube);