Movable¶
The Movable component wraps objects to make them draggable and repositionable.
This is essential for:
Creating interactive robot teleoperation interfaces
Building drag-and-drop 3D editors
Allowing users to reposition objects in VR/AR
Implementing interactive demonstrations
Basic Usage¶
A minimal example that creates a draggable gripper:
import asyncio
from vuer import Vuer, VuerSession
from vuer.schemas import DefaultScene, Movable, Gripper, Sphere, OrbitControls
app = Vuer()
@app.add_handler("OBJECT_MOVE")
async def handler(event, session):
print(f"Movement Event: key-{event.key}", event.value)
@app.spawn(start=True)
async def main(session: VuerSession):
session.set @ DefaultScene(
Movable(
Gripper(key="gripper"),
Sphere(args=[0.15], position=[0.3, 0, 0], key="sphere"),
key="movable-gripper",
position=[0, 0.5, 0],
),
bgChildren=[OrbitControls(key="OrbitControls")]
)
while True:
await asyncio.sleep(1.0)
Key Parameters¶
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
str |
- |
Unique identifier for the movable wrapper |
|
list |
|
Optional [x, y, z] offset from the position |
|
list |
|
Initial [x, y, z] position in world coordinates |
|
list |
- |
Optional [x, y, z, w] quaternion rotation |
|
list |
- |
Optional [x, y, z] Euler rotation |
|
float/list |
|
Float or [x, y, z] scale factor |
|
float/list |
- |
Optional handle size (overrides scale for handle geometry) |
|
bool |
|
Show coordinate frame visualization |
|
bool |
|
Enable wireframe rendering |
|
bool |
|
Use local rotation instead of world rotation |
Detecting Movement
Listen to the OBJECT_MOVE event to track object movements:
Event structure:
{
"key": "movable-gripper",
"position": [x, y, z],
"rotation": [rx, ry, rz, rw], # Quaternion
}