Skip to main content

<model>

Renders a GLTF model into the world.

When authoring models in blender you can tag meshes to give them different properties such as physics colliders.

Mesh Tags

Meshes in a GLTF that contain any of the following tags in their name will apply special behaviours.

TagBehaviour
_colliderMesh is both rendered and used as a convex collider
_xcolliderMesh is only used as a convex collider
_tcolliderMesh is both rendered and used as a trimesh collider
_xtcolliderMesh is only used as a trimesh collider
_climbMesh can be climbed. Must also be a collider.
_noclimbMesh canot be climbed. Must also be a collider.
_actionDeclares an actionable mesh to be used with the onPointerDown prop. If the model contains no _action tags, the whole model is actionable. If the model contains some _action tags then only those meshes will be clickable. The Event will contain the tag of the clicked mesh.

Props

PropTypeDescriptionDefault
srcStringPath to the .glb file in your assets folder. Required.
positionArrayPosition of the model.[0,0,0]
rotationArrayRotation of the model.[0,0,0]
scaleNumber|ArrayScale of the model. Use an array to declare non-scalar scale.1
hiddenBooleanWhether to hide this model. Use this for invisible physics.false
collisionStringHow collision should be handled. trimesh and convex will force all meshes to become colliders. auto will honor embedded tags.auto
onHoverEnterFunctionCalled when an avatar hovers over the model. Provides an Event
onHoverLeaveFunctionCalled when an avatar hovers out of the model. Provides an Event
onPointerDownFunctionCalled when avatar presses the pointer down over this object.
onPointerDownHintStringText displayed when hovering over this object when onPointerDown is defined.
onPointerUpFunctionCalled when avatar releases the pointer over this object.
onPointerUpHintStringText displayed when hovering over this object with the pointer down and onPointerUp is defined.
hitDistanceNumberMaximum distance to interact with this node.3

Ref

FieldDescription
setPosition(vec3)Update position
setRotation(eul)Update rotation

Notes

  • If a mesh tagged as a convex collider is not convex, it will still behave convex using a shrinkwrap-like mechanism.