ModelElement
ModelElement
represents a 3D model in the scene.
Example:
const modelElement = new ModelElement();
modelElement.src = 'models/character.glb';
modelElement.billboard = true;
modelElement.networkable = true;
modelElement.walkable = false;
scene.add(modelElement);
src: string
The source URL or file path of the 3D model asset. Typically supports formats like glb.
Example:
modelElement.src = 'models/box.glb';
billboard: boolean
When true, the model will always face the camera, commonly used for UI elements or sprites.
Example:
modelElement.billboard = true;
networkable: boolean
Indicates whether the model’s state and behavior should be synchronized across the network.
Example:
modelElement.networkable = true;
walkable: boolean
Specifies whether the model should be considered walkable in the scene, affecting navigation and collision systems.
Example:
modelElement.walkable = false;
animationMixer: THREE.AnimationMixer
Provides access to the THREE.AnimationMixer
associated with the model, enabling control over animations such as playing, pausing, and blending.
Example:
await startAnimationSession(modelElement);
modelElement.animationMixer.clipAction(modelElement.animations[1]).play();