Skip to main content

Class: GrabInteractableManager

Creates and updates grab interactable components.

Constructors

Constructor

new GrabInteractableManager(): GrabInteractableManager;

Returns

GrabInteractableManager

Methods

Create()

static Create(entity): Promise<boolean>;

Creates a grab interactable component on an entity.

Colliders added before the component is created are used for interaction detection. Interaction states include hover, select, and activate. Hover begins when a user's hand touches or points at the collider, select begins when the user presses the grip input to grab the entity, and activate begins when the user presses the trigger input.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.

Returns

Promise<boolean>

A promise that resolves to true if the grab interactable component was created, or false otherwise.


MakeNetworkGrabble()

static MakeNetworkGrabble(entity): Promise<void>;

Makes a grab interactable network-aware.

The grab interactable can then be used by network users, and its transform is synchronized across the network session. An error is thrown in local mode or when the entity does not use a network transform.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.

Returns

Promise<void>

A promise that resolves when network grab behavior has been configured.


Destroy()

static Destroy(entity): Promise<boolean>;

Removes a grab interactable component from an entity.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.

Returns

Promise<boolean>

A promise that resolves to true if the component was removed, or false otherwise.


HasComponent()

static HasComponent(entity): Promise<boolean>;

Checks whether an entity has a grab interactable component.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<boolean>

A promise that resolves to true if the component exists, or false otherwise.


SetEnabled()

static SetEnabled(entity, enabled): Promise<void>;

Sets whether a grab interactable component is enabled.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
enabledbooleanWhether the grab interactable component is enabled.

Returns

Promise<void>

A promise that resolves when the enabled state has been changed.


GetEnabled()

static GetEnabled(entity): Promise<boolean>;

Gets whether a grab interactable component is enabled.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<boolean>

A promise that resolves to true if the component is enabled, or false otherwise.


GetTrackPosition()

static GetTrackPosition(entity): Promise<boolean>;

Gets whether the grab interactable tracks position.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<boolean>

A promise that resolves to true if position tracking is enabled, or false otherwise.


SetTrackPosition()

static SetTrackPosition(entity, isTracking): Promise<void>;

Sets whether a grab interactable tracks position.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
isTrackingbooleanWhether position tracking is enabled.

Returns

Promise<void>

A promise that resolves when the setting has been changed.


GetTrackRotation()

static GetTrackRotation(entity): Promise<boolean>;

Gets whether the grab interactable tracks rotation.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<boolean>

A promise that resolves to true if rotation tracking is enabled, or false otherwise.


SetTrackRotation()

static SetTrackRotation(entity, isTracking): Promise<void>;

Sets whether a grab interactable tracks rotation.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
isTrackingbooleanWhether rotation tracking is enabled.

Returns

Promise<void>

A promise that resolves when the setting has been changed.


GetThrowOnDetach()

static GetThrowOnDetach(entity): Promise<boolean>;

Gets whether a grab interactable applies physics-based throwing on detach.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<boolean>

A promise that resolves to true if throw-on-detach is enabled, or false otherwise.


SetThrowOnDetach()

static SetThrowOnDetach(entity, enable): Promise<void>;

Sets whether a grab interactable applies physics-based throwing on detach.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
enablebooleanWhether throw-on-detach is enabled.

Returns

Promise<void>

A promise that resolves when the setting has been changed.


GetAttachEntity()

static GetAttachEntity(entity): Promise<number>;

Gets the attach entity of a grab interactable.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<number>

A promise that resolves to the attached Entity.


SetAttachEntity()

static SetAttachEntity(entity, attachEntity): Promise<void>;

Sets the attach entity of a grab interactable.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
attachEntitynumberThe target Entity to attach to.

Returns

Promise<void>

A promise that resolves when the attach entity has been changed.


SetAllowHoverActivate()

static SetAllowHoverActivate(entity, allowHoverActivate): Promise<void>;

Sets whether hover activation is allowed.

When enabled, the object can be activated with the trigger input while it is hovered, without being selected first.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
allowHoverActivatebooleanWhether hover activation is allowed.

Returns

Promise<void>

A promise that resolves when the setting has been changed.


GetAllowHoverActivate()

static GetAllowHoverActivate(entity): Promise<boolean>;

Gets whether hover activation is allowed.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<boolean>

A promise that resolves to true if hover activation is allowed, or false otherwise.


SetDynamicAttach()

static SetDynamicAttach(entity, dynamicAttach): Promise<void>;

Sets whether dynamic attach is enabled.

When enabled, the object can be grabbed directly at the collider contact point, and the attach anchor does not move to the hand transform.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
dynamicAttachbooleanWhether dynamic attach is enabled.

Returns

Promise<void>

A promise that resolves when the setting has been changed.


GetDynamicAttach()

static GetDynamicAttach(entity): Promise<boolean>;

Gets whether dynamic attach is enabled.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<boolean>

A promise that resolves to true if dynamic attach is enabled, or false otherwise.


SetMovementType()

static SetMovementType(entity, movementType): Promise<void>;

Sets the movement type of a grab interactable.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
movementTypeMovementTypeThe movement type to assign.

Returns

Promise<void>

A promise that resolves when the movement type has been changed.


GetMovementType()

static GetMovementType(entity): Promise<MovementType>;

Gets the movement type of a grab interactable.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<MovementType>

A promise that resolves to the movement type.


CancelSelect()

static CancelSelect(entity): Promise<void>;

Cancels the current select state of a grab interactable.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.

Returns

Promise<void>

A promise that resolves when the select state has been canceled.


AddHoverEnteredCallback()

static AddHoverEnteredCallback(entity, onHoverEntered): Promise<void>;

Registers a callback for hover enter events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onHoverEntered(interactableEntity, interactorEntity) => voidThe callback invoked when hover begins.

Returns

Promise<void>

A promise that resolves when the callback has been registered.


AddHoverExitedCallback()

static AddHoverExitedCallback(entity, onHoverExited): Promise<void>;

Registers a callback for hover exit events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onHoverExited(interactableEntity, interactorEntity) => voidThe callback invoked when hover ends.

Returns

Promise<void>

A promise that resolves when the callback has been registered.


AddSelectEnteredCallback()

static AddSelectEnteredCallback(entity, onSelectEntered): Promise<void>;

Registers a callback for select enter events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onSelectEntered(interactableEntity, interactorEntity) => voidThe callback invoked when selection begins.

Returns

Promise<void>

A promise that resolves when the callback has been registered.


AddSelectExitedCallback()

static AddSelectExitedCallback(entity, onSelectExited): Promise<void>;

Registers a callback for select exit events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onSelectExited(interactableEntity, interactorEntity) => voidThe callback invoked when selection ends.

Returns

Promise<void>

A promise that resolves when the callback has been registered.


AddActivatedCallback()

static AddActivatedCallback(entity, onActivated): Promise<void>;

Registers a callback for activate events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onActivated(interactableEntity, interactorEntity) => voidThe callback invoked when activation begins.

Returns

Promise<void>

A promise that resolves when the callback has been registered.


AddDeactivatedCallback()

static AddDeactivatedCallback(entity, onDeactivated): Promise<void>;

Registers a callback for deactivate events.

Parameters

ParameterTypeDescription
entitynumberThe Entity to observe.
onDeactivated(interactableEntity, interactorEntity) => voidThe callback invoked when activation ends.

Returns

Promise<void>

A promise that resolves when the callback has been registered.