Vuer

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
key str - Unique identifier for the controllers
stream bool False Enable streaming of controller pose data
left bool True Enable left controller tracking
right bool True 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:

Learn More

For detailed examples of using MotionControllers, see: