Grabbable
Updated
Lets the player pick up and drag the entity with mouse, ray or hand.
- Type
comp-grabbable- Script class
GrabbableComponent- Per entity
- One
- Version
- 1.0.0
Read about it in Selection and grabbing: what it does, how to use it from a script, and examples.
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
Grabbable::startGrabbable::endGrabbable::hoverGrabbable::leave
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
A draggable panel with a grip and a solid backAn inventory panel that a Behavior script makes draggable: a Grabbable, a UI Handle grip under it and an opaque UI Backdrop so it is not see-through from behind.
Drag the grip under the panel, or the panel itself, to move it. Drag the background to orbit round and see its solid back; scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(GrabbableComponent); if (component) log(component.props);}