UxrGrabber Class

Component that added to an UxrAvatar allows to interact with UxrGrabbableObject entities. Normally there are two per avatar, one on each hand. They are usually added to the hand object since it is the UxrGrabber transform where grabbable objects will be snapped to when snapping is used.

By default, the grabber transform is also used to compute distances to grabbable objects. Additional proximity transforms can be specified on the grabber so that grabbable objects can choose which one is used. This can be useful in some scenarios: In an aircraft cockpit most knobs and buttons will prefer the distance from the tip of the index finger, while bigger objects will prefer from the palm of the hand.

Inheritance Hierarchy

System.Object
  Object
    Component
      Behaviour
        MonoBehaviour
          UltimateXR.Core.Components.UxrComponent
            UltimateXR.Core.Components.UxrComponent(UxrGrabber)
              UltimateXR.Core.Components.Composite.UxrAvatarComponent(UxrGrabber)
                UltimateXR.Manipulation.UxrGrabber
Namespace: UltimateXR.Manipulation
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public class UxrGrabber : UxrAvatarComponent<UxrGrabber>


The UxrGrabber type exposes the following members.

Constructors

NameDescription
Public methodUxrGrabber

Properties

NameDescription
Public propertyAngularVelocity Gets UxrGrabber’s current frame angular velocity.
Public propertyFingerDirection Gets from all the positive and negative axes in the grabber’s transform, the axis in world-space that is pointing to the fingers, excluding the thumb.
Public propertyGrabbedObject Gets the currently grabbed object if there is one. null if no object is being grabbed.
Public propertyHandBone Gets the avatar hand bone that corresponds to the grabber.
Public propertyHandBoneRelativePos Gets the relative position of the hand bone to the grabber.
Public propertyHandBoneRelativeRot Gets the relative rotation of the hand bone to the grabber.
Public propertyHandRenderer Gets or sets the hand renderer.
Public propertyLocalFingerDirection Gets from all the positive and negative axes in the grabber’s transform, the axis in local-space that is pointing to the fingers, excluding the thumb.
Public propertyLocalPalmOutDirection Gets from all the positive and negative axes in the grabber’s transform, the axis in local-space that is pointing outwards from the palm.
Public propertyLocalPalmThumbDirection Gets from all the positive and negative axes in the grabber’s transform, the axis in local-space that is pointing towards the thumb.
Public propertyOppositeHandGrabber Gets the opposite hand grabber in the same avatar.
Public propertyOppositeSide Gets whether the grabber component is on the left or right hand.
Public propertyPalmOutDirection Gets from all the positive and negative axes in the grabber’s transform, the axis in world-space that is pointing outwards from the palm..
Public propertyPalmThumbDirection Gets from all the positive and negative axes in the grabber’s transform, the axis in world-space that is pointing towards the thumb.
Public propertyRequiredMirrorType

Gets, based on FingerDirection and PalmOutDirection, which mirroring snap transforms should use with the grabber if they want to be mirrored. Snap transforms are GameObjects in UxrGrabbableObject that determine where the hand should be placed during grabs by making the UxrGrabber’s transform align with the snap Transform. Mirroring snap transforms is used to quickly create/modify grab positions/orientations.

Public propertySide Gets whether the grabber component is on the left or right hand.
Public propertySmoothAngularVelocity Gets UxrGrabber’s angular velocity smoothed using averaged previous frame data.
Public propertySmoothVelocity Gets UxrGrabber’s velocity smoothed using averaged previous frame data.
Public propertyUnprocessedGrabberPosition The unprocessed grabber position. This is the position the grabber has taking only the hand controller tracking sensor into account. The hand position is updated by the UxrGrabManager and may be forced into a certain position if the object being grabbed has constraints, altering also the UxrGrabber position. Sometimes it is preferred to use the unprocessed grabber position.
Public propertyUnprocessedGrabberRotation Gets the unprocessed grabber rotation. See UnprocessedGrabberPosition.
Public propertyVelocity Gets UxrGrabber’s current frame velocity.

Methods

NameDescription
Protected methodAwake Initializes the component. (Overrides UxrAvatarComponent<T>.Awake().)
Public methodGetProximityTransform Gets the given proximity transform, used to compute distances toUxrGrabbableObject entities
Protected methodOnDestroy Called when the object is destroyed. Releases any grabbed objects. (Overrides UxrComponent<T>.OnDestroy().)
Protected methodOnDisable Called when the object is disabled. Releases any grabbed objects. (Overrides UxrComponent<T>.OnDisable().)

Extension Methods

NameDescription
Public Extension MethodCheckSetEnabled Enables/disabled the component if it isn’t enabled already. (Defined by MonoBehaviourExt.)
Public Extension MethodGetOrAddComponent<T> Gets the Component of a given type. If it doesn’t exist, it is added to the GameObject. (Defined by ComponentExt.)
Public Extension MethodGetPathUnderScene Gets the full path under current scene, including all parents, but scene name, for the given component. (Defined by ComponentExt.)
Public Extension MethodGetSceneUid Gets an unique identifier string for the given component. (Defined by ComponentExt.)
Public Extension MethodGetUniqueScenePath Gets an unique path in the scene for the given component. It will include scene name, sibling and component indices to make it unique. (Defined by ComponentExt.)
Public Extension MethodLoopCoroutine Creates a coroutine that simplifies executing a loop during a certain amount of time. (Defined by MonoBehaviourExt.)
Public Extension MethodSafeGetComponentInParent<T> Gets the Component of a given type in the GameObject or any of its parents. It also works on prefabs, where regular GetComponentInParent(Type, Boolean) will not work: https://issuetracker.unity3d.com/issues/getcomponentinparent-is-returning-null-when-the-gameobject-is-a-prefab (Defined by ComponentExt.)
Public Extension MethodShowInInspector(Boolean)Overloaded.
Controls whether to show the current object in the inspector. (Defined by ObjectExt.)
Public Extension MethodShowInInspector(Boolean, Boolean)Overloaded.
Controls whether to show the current object in the inspector and whether it is editable. (Defined by ObjectExt.)
Public Extension MethodThrowIfNull Throws an exception if the object is null. (Defined by ObjectExt.)

See Also

Reference

UltimateXR.Manipulation Namespace