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
Name | Description | |
---|---|---|
UxrGrabber |
Properties
Name | Description | |
---|---|---|
AngularVelocity | Gets UxrGrabber’s current frame angular velocity. | |
FingerDirection | 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. | |
GrabbedObject | Gets the currently grabbed object if there is one. null if no object is being grabbed. | |
HandBone | Gets the avatar hand bone that corresponds to the grabber. | |
HandBoneRelativePos | Gets the relative position of the hand bone to the grabber. | |
HandBoneRelativeRot | Gets the relative rotation of the hand bone to the grabber. | |
HandRenderer | Gets or sets the hand renderer. | |
LocalFingerDirection | 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. | |
LocalPalmOutDirection | 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. | |
LocalPalmThumbDirection | Gets from all the positive and negative axes in the grabber’s transform, the axis in local-space that is pointing towards the thumb. | |
OppositeHandGrabber | Gets the opposite hand grabber in the same avatar. | |
OppositeSide | Gets whether the grabber component is on the left or right hand. | |
PalmOutDirection | 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.. | |
PalmThumbDirection | Gets from all the positive and negative axes in the grabber’s transform, the axis in world-space that is pointing towards the thumb. | |
RequiredMirrorType |
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. | |
Side | Gets whether the grabber component is on the left or right hand. | |
SmoothAngularVelocity | Gets UxrGrabber’s angular velocity smoothed using averaged previous frame data. | |
SmoothVelocity | Gets UxrGrabber’s velocity smoothed using averaged previous frame data. | |
UnprocessedGrabberPosition | 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. | |
UnprocessedGrabberRotation | Gets the unprocessed grabber rotation. See UnprocessedGrabberPosition. | |
Velocity | Gets UxrGrabber’s current frame velocity. |
Methods
Name | Description | |
---|---|---|
Awake | Initializes the component. (Overrides UxrAvatarComponent<T>.Awake().) | |
GetProximityTransform | Gets the given proximity transform, used to compute distances toUxrGrabbableObject entities | |
OnDestroy | Called when the object is destroyed. Releases any grabbed objects. (Overrides UxrComponent<T>.OnDestroy().) | |
OnDisable | Called when the object is disabled. Releases any grabbed objects. (Overrides UxrComponent<T>.OnDisable().) |
Extension Methods
Name | Description | |
---|---|---|
CheckSetEnabled | Enables/disabled the component if it isn’t enabled already. (Defined by MonoBehaviourExt.) | |
GetOrAddComponent<T> | Gets the Component of a given type. If it doesn’t exist, it is added to the GameObject. (Defined by ComponentExt.) | |
GetPathUnderScene | Gets the full path under current scene, including all parents, but scene name, for the given component. (Defined by ComponentExt.) | |
GetSceneUid | Gets an unique identifier string for the given component. (Defined by ComponentExt.) | |
GetUniqueScenePath | 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.) | |
LoopCoroutine | Creates a coroutine that simplifies executing a loop during a certain amount of time. (Defined by MonoBehaviourExt.) | |
SafeGetComponentInParent<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.) | |
ShowInInspector(Boolean) | Overloaded. Controls whether to show the current object in the inspector. (Defined by ObjectExt.) | |
ShowInInspector(Boolean, Boolean) | Overloaded. Controls whether to show the current object in the inspector and whether it is editable. (Defined by ObjectExt.) | |
ThrowIfNull | Throws an exception if the object is null. (Defined by ObjectExt.) |