UxrGrabManager Class

Manager that takes care of updating all the manipulation mechanics. The manipulation system handles three main types of entities:  

Inheritance Hierarchy

System.Object
  Object
    Component
      Behaviour
        MonoBehaviour
          UltimateXR.Core.Components.UxrComponent
            UltimateXR.Core.Components.Singleton.UxrAbstractSingleton(UxrGrabManager)
              UltimateXR.Core.Components.Singleton.UxrSingleton(UxrGrabManager)
                UltimateXR.Manipulation.UxrGrabManager
Namespace: UltimateXR.Manipulation
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public class UxrGrabManager : UxrSingleton<UxrGrabManager>, 
	IUxrStateSync, IUxrLogger


The UxrGrabManager type exposes the following members.

Constructors

NameDescription
Public methodUxrGrabManager

Properties

NameDescription
Public propertyCurrentGrabbedObjects Gets the currently grabbed objects.
Public propertyIsGrabbingAllowed Gets or sets whether grabbing is allowed.
Public propertyLogLevel Gets or sets the current log level. This controls the amount of information sent.

Methods

NameDescription
Protected methodAwake Initializes the manager and subscribes to global events. (Overrides UxrAbstractSingleton<T>.Awake().)
Public methodCanGrabSomething(UxrGrabber) Checks whether a UxrGrabber can grab something using the given grabber.
Public methodCanGrabSomething(UxrAvatar, UxrHandSide) Checks whether an UxrAvatar can grab something using the given hand.
Public methodGetClosestGrabbableObject(UxrGrabber, UxrGrabbableObject, Int32, IEnumerable(UxrGrabbableObject)) Gets the closest grabbable object that can be grabbed by a UxrGrabber.
Public methodGetClosestGrabbableObject(UxrAvatar, UxrHandSide, UxrGrabbableObject, Int32, IEnumerable(UxrGrabbableObject)) Gets the closest grabbable object that can be grabbed by an UxrAvatar using the given hand.
Public methodGetGrabbedObjectAnchorFrom Gets the UxrGrabbableObjectAnchor where the given UxrGrabbableObject was grabbed from.
Public methodGetGrabbedObjectAngularVelocity Gets the current world-space angular velocity, in degrees per second, of an object that is being grabbed.
Public methodGetGrabbedObjectVelocity Gets the current world-space velocity, in units per second, of an object that is being grabbed.
Public methodGetGrabbedPoint Gets the grab point that the UxrGrabber is currently grabbing on a UxrGrabbableObject .
Public methodGetGrabbedPointCount Gets the number of grab points that are currently being grabbed from a UxrGrabbableObject.
Public methodGetGrabbingHand(UxrGrabbableObject, Boolean, Boolean) Gets the hands that are grabbing an object.
Public methodGetGrabbingHand(UxrGrabbableObject, Int32, UxrHandSide) Gets the hand grabbing the given object using a given grab point.
Public methodGetGrabbingHand(UxrGrabbableObject, Int32, UxrGrabber) Gets the grabber that is grabbing an object using a specific grab point.
Public methodGetGrabbingHandCount Gets the number of hands that are grabbing the given object.
Public methodGetGrabbingHands Gets the grabbers that are grabbing the object using a specific grab point.
Public methodGetHandsGrabbingCount Gets the number of hands currently grabbing an object.
Public methodGetObjectBeingGrabbed Gets the object being grabbed by an avatar.
Public methodGetOverrideGrabPoseBlendValue Gets the blend value for the Blend pose used when grabbing the given UxrGrabbableObject using the UxrGrabber. Blending is used to transition between different states such as open/closed or similar.
Public methodGetOverrideGrabPoseName Gets the grab pose name required when grabbing the given UxrGrabbableObject using the UxrGrabber.
Public methodGrabObject Grabs an object.
Public methodIsBeingGrabbed(UxrGrabbableObject) Checks whether the given grabbable object is being grabbed.
Public methodIsBeingGrabbed(UxrGrabbableObject, Int32) Checks whether the given grabbable object is being grabbed using the given grab point.
Public methodIsBeingGrabbedBy(UxrGrabbableObject, UxrAvatar) Checks whether the given grabbable object is being grabbed by an avatar.
Public methodIsBeingGrabbedBy(UxrGrabbableObject, UxrGrabber) Checks whether the given grabbable object is being grabbed by a specific grabber.
Public methodIsBeingGrabbedByOtherThan(UxrGrabbableObject, Int32) Checks whether the given grabbable object is being grabbed using any other grab point than the specified.
Public methodIsBeingGrabbedByOtherThan(UxrGrabbableObject, Int32, UxrGrabber) Checks whether the given grabbable object is being grabbed using any other grab point and any other grabber than the specified.
Public methodIsHandGrabbing(UxrAvatar, UxrHandSide) Checks whether the given UxrAvatar hand is currently grabbing something.
Public methodIsHandGrabbing(UxrAvatar, UxrGrabbableObject, UxrHandSide, Boolean) Checks if an avatar’s hand is grabbing a grabbable object.
Protected methodOnDestroy Unsubscribes from global events. (Overrides UxrAbstractSingleton<T>.OnDestroy().)
Protected methodOnDisable Unsubscribes from events. (Overrides UxrComponent.OnDisable().)
Protected methodOnEnable Subscribes to events. (Overrides UxrComponent.OnEnable().)
Public methodPlaceObject Places a UxrGrabbableObject on an UxrGrabbableObjectAnchor. It can be placed either instantly or smoothly depending on placementType. If the object is currently being grabbed, all grips will be released. There is one exception to this: when the object is constrained to the world (IsConstrained) because in this case the constraints may prevent the grip from removing the object from the anchor again.
Public methodReleaseGrabs Releases all grabs on a given UxrGrabbableObject.
Public methodReleaseObject Releases an object from a hand.
Public methodRemoveObjectFromAnchor Removes a UxrGrabbableObject placed on an UxrGrabbableObjectAnchor.
Public methodShouldHideHandRenderer Gets whether grabbing a given UxrGrabbableObject using a certain UxrGrabber will make the grabber’s renderer show up as hidden due to the parameters set in the inspector.
Public methodSyncState Executes the state change described by [!:e].
Public methodTryGrab Tries to grab something.
Public methodTryRelease Tries to release something.

Events

NameDescription
Public eventAnchorRangeEntered Event called whenever an UxrGrabbableObject being grabbed by a UxrGrabber entered the valid placement range (distance) of a compatible UxrGrabbableObjectAnchor. The following properties from UxrManipulationEventArgs will contain meaningful data:  
  • GrabbableObject: Object that entered the valid placement range.
  • GrabbableAnchor: Anchor where the object can potentially be placed.
  • Grabber: Grabber that is holding the object. If more than one grabber is holding it, it will indicate the first one to grab it.
Public eventAnchorRangeLeft Same as AnchorRangeEntered but when leaving the valid range.
Public eventGrabTrying Event called whenever a UxrGrabber component is about to try to grab something (a hand is beginning to close). If it ends up grabbing something will depend on whether there is a UxrGrabbableObject in reach. Properties available:  
  • Grabber: Grabber that tried to grab.
Public eventObjectGrabbed Same as ObjectGrabbing but called right after the object was grabbed.
Public eventObjectGrabbing Event called whenever a UxrGrabber component is about to grab a UxrGrabbableObject. The following properties from UxrManipulationEventArgs will contain meaningful data:  
  • GrabbableObject: Object that is about to be grabbed.
  • GrabbableAnchor: Anchor where the object is currently placed. Null if it isn’t placed.
  • Grabber: Grabber that is about to grab the object.
  • GrabPointIndex: Grab point index of the object that is about to be grabbed.
  • IsMultiHands: true if it is already being grabbed with one hand and it will be grabbed with both hands after. False if no hand is currently grabbing it.
Public eventObjectPlaced Same as ObjectPlacing but called right after the object was placed.
Public eventObjectPlacing Event called whenever a UxrGrabbableObject is about to be placed on an UxrGrabbableObjectAnchor. The following properties from UxrManipulationEventArgs will contain meaningful data:  
Public eventObjectReleased Same as ObjectReleasing but called right after the object was released.
Public eventObjectReleasing Event called whenever a UxrGrabber component is about to release the UxrGrabbableObject that it is holding and there is no UxrGrabbableObjectAnchor nearby to place it on. The following properties from UxrManipulationEventArgs will contain meaningful data:  
  • GrabbableObject: Object that is about to be released.
  • GrabbableAnchor: Anchor where the object was originally grabbed from. Null if it wasn’t grabbed from an anchor.
  • Grabber: Grabber that is about to release the object.
  • GrabPointIndex: Grab point index of the object that is being grabbed by the UxrGrabber.
  • IsMultiHands: true if it is already being grabbed with another hand that will keep it holding. False if no other hand is currently grabbing it.
  • IsSwitchHands: True if it was released because another UxrGrabber grabbed it, false otherwise. if IsMultiHands is true then IsSwitchHands will tell if it was released by both hands (false) or if it was just released by one hand and the other one still keeps it grabbed (true).
  • ReleaseVelocity: Velocity the object is being released with.
  • ReleaseAngularVelocity: Angular velocity the object is being released with.
Public eventObjectRemoved Same as ObjectRemoving but called right after the object was removed.
Public eventObjectRemoving Event called whenever a UxrGrabbableObject is about to be removed from an UxrGrabbableObjectAnchor. The following properties from UxrManipulationEventArgs will contain meaningful data:  
Public eventPlacedObjectRangeEntered Event called whenever a UxrGrabber enters the valid grab range (distance) of a UxrGrabbableObject placed on an UxrGrabbableObjectAnchor. The following properties from UxrManipulationEventArgs will contain meaningful data:  
Public eventPlacedObjectRangeLeft Same as PlacedObjectRangeEntered but when leaving the valid range.
Public eventStateChanged Event raised when a relevant state of an object changed and requires storage/synchronization.

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