xrConform.tool
This package holds more than this page lists. See all of its files in its world.
README.md
xrConform
Check how a world plays in a headset, for one entity the game expects the player to look at or point at: a pickup, a button, a door. It starts a simulated XR session when none is running and stops it afterwards.
It turns the simulated head to face the entity and reports what the viewport
camera's forward ray meets, which is what a game that aims with its camera
hits. It turns the dominant controller to the entity and reports what the ray
the game builds from its mouse (screenToRay at the mouse position) meets.
It lists every visible game screen with whether an XR panel shows it.
local report = tools.use("inputSim", "xrConform", "pickup")
print(report.look.hit, report.look.entity) -- the camera's forward ray
print(report.point.hit, report.point.onLaser) -- the ray built from the mouse
for _, screen in report.screens do print(screen.name, screen.onPanel) end
-- an entity whose origin stands at its feet: aim a metre above it
tools.use("inputSim", "xrConform", "door", { x = 0, y = 1, z = 0 })
The answer is data:
| Field | Meaning |
|---|---|
look.hit | The camera's forward ray meets the entity, or something under it. |
look.entity, look.distance | What the ray met first. |
look.errorDegrees | How far the settled head stands from the entity. |
point.hit, point.entity, point.distance | The same for the ray built from the game's mouse. |
point.onLaser | The ray built from the mouse is the laser's own ray. |
point.panel, point.reason | The world panel the laser meets before the entity (the game's mouse stands off the view while a panel takes the laser), or why no ray was built from the mouse. |
screens[] | name, space, onPanel and the panel showing it, for each visible game screen. |
startedSession | The tool started the simulated session (and stopped it again). |
A hit of false with an entity names what stands in the way. The head and
the controller are put back to the headset runtime afterwards.