Builtin Library
README.md
xr_models
The hands and the controllers of a headset as models in the world. A hand is a
rigged hand mesh whose 25 joint bones stand where the runtime puts the hand's
joints, so the fingers bend as the person's do. A controller is the model of the
Quest Touch Plus controller, with its trigger, squeeze, thumbstick and buttons
moving as the person presses them. Both are temporary entities on the layer
xrEyes, which only the person's own eyes draw. Their meshes state
pickable = false, so the laser, which starts inside the hand or the controller,
and the look ray hit the scene behind them (getPointerHitTable()).
local Models = require("@builtin::modules.api.engine.xr_models")
Models.tick({ mode = engine.mode, bodyHands = { left_hand = false, right_hand = false } })
What shows follows the input:
- a hand shows while a controller or hand tracking drives it and the player's body does not draw it with its own arm. Around a held controller the hand is the model of a hand holding it;
- a controller shows in edit mode while it is held. It never shows in play mode and never while its hand is tracked bare.
The models are the WebXR Input Profiles project's generic-hand and
meta-quest-touch-plus assets, MIT licensed (models/xr/LICENSE.md holds the
source and the licence).
setInput(source) reads the tracked devices from a table of handSource(role),
joints(role), controller(role) and pose(role) in place of the XR session, which
is how a test or a desktop engine shows the models. status() says which models
stand and whether they are ready; release() takes them all down.