Grabbable

Description

An abstract class that provides basic functionality for objects that can be grabbed by an InteractionHand. It's concrete implementations can be attached to any object that needs to be grabbable in the scene. It requires a Rigidbody and a VelocityEstimator component to be attached to the same GameObject. It has various evemts that can be subscribed to, such as OnFirstAttach, OnAttach, OnHeld, OnDetach and OnReset. The Grabbable class is a foundation for more specialized grabbables such as ProximityInteractionHand and DistanceInteractionHand.

Public properties

bool IsPrecisionGrab

  • determines whether or not the grabbable will move to its grab controller's transform

  • also determines whether or not the interaction hand will look for poses to apply

InteractionHand CurrentInteractionHand

  • Current grab controller in control of this object

bool IsGrabbed

  • Signifies that the object is currently being grabbed by a grab controller, preventing other grab controllers to take control of it

Rigidbody RigidBody

Vector3 InitialLocalScale

Public methods

virtual void Attach(Transform grabParent)

  • attaches the object to the grab controller

  • starts estimating velocity

  • invokes OnAttach event

  • calls the Attach method from the given grabbable

virtual void Detach()

  • detaches the object from the grab controller

  • stops estimating velocity

  • invokes OnDetach event

  • calls the Detach method from the given grabbable modifier

Unity events

OnHover

OnUnhover

OnFirstAttach

OnAttach

OnHeld

OnDetach

Last updated