Skip to content

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.

Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.

  • Grabbable::start
  • Grabbable::end
  • Grabbable::hover
  • Grabbable::leave

Run it in the browser, read its scripts, and download it as an XR Creator project.

#pragma lifecycle(startup)
function startup() {
const component = self.parent.getComponent(GrabbableComponent);
if (component) log(component.props);
}