MotionControllers¶
Warning: This example is still under construction. now reference: Motion Controllers
The MotionControllers component enables VR motion controller tracking.
This is essential for:
VR controller input in WebXR applications
Building VR interaction interfaces
Robot teleoperation with VR controllers
Creating immersive VR experiences
Basic Usage¶
A minimal example that enables motion controller tracking:
import asyncio
from vuer import Vuer, VuerSession
from vuer.schemas import MotionControllers
app = Vuer()
@app.add_handler("CONTROLLER_MOVE")
async def handler(event, session):
print(f"Controller Event:", event.value)
@app.spawn(start=True)
async def main(session: VuerSession):
session.upsert(
MotionControllers(
stream=True,
key="controllers",
),
to="bgChildren",
)
while True:
await asyncio.sleep(1.0)
Key Parameters¶
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
str |
- |
Unique identifier for the controllers |
|
bool |
|
Enable streaming of controller pose data |
|
bool |
|
Enable left controller tracking |
|
bool |
|
Enable right controller tracking |
Controller Data Format¶
The CONTROLLER_MOVE event returns pose and button data for each controller.
SSL Requirement¶
WebXR requires HTTPS. Use ngrok or localtunnel for development:
ngrok: https://ngrok.com/docs
localtunnel: https://localtunnel.me
Learn More¶
For detailed examples of using MotionControllers, see:
Motion Controllers - Complete VR controller tutorial