Technical manual
...
Spatial module
Spatial input & WebXR
2 min
supporting multiple input sources input can come from a variety of places in non immersive contexts it usually comes from a gamepad, mouse, keyboard, or screen touches in immersive contexts it comes from the viewer's 6dof perspective, and a variety of device specific extensions such as 6dof controllers, hands, gamepads, and potentially more since this engine is immersive first, the abstractions of easily unifying all these input sources are naturally to spatialize them where possible, and using webxr and other web specifications to guide the api layers the first component to introduce is the inputsourcecomponent which stores the input source information according to the webxr xrinputsource interface, as well as generalized accessor for current button states and entity intersections if the input source is spatial, it will have a transformcomponent and xrspacecomponent , which stores the spatial information about the source if the input source originates from a pointer (mouse or touch), it will store this information in an inputpointercomponent , which also stores a reference to the html canvas object it originated from during the input system phase, the clientinputsystem calculates all the runtime information, such as transform and intersections for input sources for each intersection, it also stores the intersecting input source entity on the first intersected entity if the inputcomponent exists on that entity, which effectively specifies an entity is an input receiver input can be "captured" globally by an entity by mutating the capturingentity property on inputstate , which enforces that only that entity should receive input