UxrGrabManager Class
Manager that takes care of updating all the manipulation mechanics. The manipulation system handles three main types of entities:
- UxrGrabber: Components usually assigned to each hand of an UxrAvatar and that are able to grab objects
- UxrGrabbableObject: Objects that can be grabbed
- UxrGrabbableObjectAnchor: Anchors where grabbable objects can be placed
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
Name | Description | |
---|---|---|
UxrGrabManager |
Properties
Name | Description | |
---|---|---|
CurrentGrabbedObjects | Gets the currently grabbed objects. | |
IsGrabbingAllowed | Gets or sets whether grabbing is allowed. | |
LogLevel | Gets or sets the current log level. This controls the amount of information sent. |
Methods
Name | Description | |
---|---|---|
Awake | Initializes the manager and subscribes to global events. (Overrides UxrAbstractSingleton<T>.Awake().) | |
CanGrabSomething(UxrGrabber) | Checks whether a UxrGrabber can grab something using the given grabber. | |
CanGrabSomething(UxrAvatar, UxrHandSide) | Checks whether an UxrAvatar can grab something using the given hand. | |
GetClosestGrabbableObject(UxrGrabber, UxrGrabbableObject, Int32, IEnumerable(UxrGrabbableObject)) | Gets the closest grabbable object that can be grabbed by a UxrGrabber. | |
GetClosestGrabbableObject(UxrAvatar, UxrHandSide, UxrGrabbableObject, Int32, IEnumerable(UxrGrabbableObject)) | Gets the closest grabbable object that can be grabbed by an UxrAvatar using the given hand. | |
GetGrabbedObjectAnchorFrom | Gets the UxrGrabbableObjectAnchor where the given UxrGrabbableObject was grabbed from. | |
GetGrabbedObjectAngularVelocity | Gets the current world-space angular velocity, in degrees per second, of an object that is being grabbed. | |
GetGrabbedObjectVelocity | Gets the current world-space velocity, in units per second, of an object that is being grabbed. | |
GetGrabbedPoint | Gets the grab point that the UxrGrabber is currently grabbing on a UxrGrabbableObject . | |
GetGrabbedPointCount | Gets the number of grab points that are currently being grabbed from a UxrGrabbableObject. | |
GetGrabbingHand(UxrGrabbableObject, Boolean, Boolean) | Gets the hands that are grabbing an object. | |
GetGrabbingHand(UxrGrabbableObject, Int32, UxrHandSide) | Gets the hand grabbing the given object using a given grab point. | |
GetGrabbingHand(UxrGrabbableObject, Int32, UxrGrabber) | Gets the grabber that is grabbing an object using a specific grab point. | |
GetGrabbingHandCount | Gets the number of hands that are grabbing the given object. | |
GetGrabbingHands | Gets the grabbers that are grabbing the object using a specific grab point. | |
GetHandsGrabbingCount | Gets the number of hands currently grabbing an object. | |
GetObjectBeingGrabbed | Gets the object being grabbed by an avatar. | |
GetOverrideGrabPoseBlendValue | 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. | |
GetOverrideGrabPoseName | Gets the grab pose name required when grabbing the given UxrGrabbableObject using the UxrGrabber. | |
GrabObject | Grabs an object. | |
IsBeingGrabbed(UxrGrabbableObject) | Checks whether the given grabbable object is being grabbed. | |
IsBeingGrabbed(UxrGrabbableObject, Int32) | Checks whether the given grabbable object is being grabbed using the given grab point. | |
IsBeingGrabbedBy(UxrGrabbableObject, UxrAvatar) | Checks whether the given grabbable object is being grabbed by an avatar. | |
IsBeingGrabbedBy(UxrGrabbableObject, UxrGrabber) | Checks whether the given grabbable object is being grabbed by a specific grabber. | |
IsBeingGrabbedByOtherThan(UxrGrabbableObject, Int32) | Checks whether the given grabbable object is being grabbed using any other grab point than the specified. | |
IsBeingGrabbedByOtherThan(UxrGrabbableObject, Int32, UxrGrabber) | Checks whether the given grabbable object is being grabbed using any other grab point and any other grabber than the specified. | |
IsHandGrabbing(UxrAvatar, UxrHandSide) | Checks whether the given UxrAvatar hand is currently grabbing something. | |
IsHandGrabbing(UxrAvatar, UxrGrabbableObject, UxrHandSide, Boolean) | Checks if an avatar’s hand is grabbing a grabbable object. | |
OnDestroy | Unsubscribes from global events. (Overrides UxrAbstractSingleton<T>.OnDestroy().) | |
OnDisable | Unsubscribes from events. (Overrides UxrComponent.OnDisable().) | |
OnEnable | Subscribes to events. (Overrides UxrComponent.OnEnable().) | |
PlaceObject | 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. | |
ReleaseGrabs | Releases all grabs on a given UxrGrabbableObject. | |
ReleaseObject | Releases an object from a hand. | |
RemoveObjectFromAnchor | Removes a UxrGrabbableObject placed on an UxrGrabbableObjectAnchor. | |
ShouldHideHandRenderer | 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. | |
SyncState | Executes the state change described by [!:e]. | |
TryGrab | Tries to grab something. | |
TryRelease | Tries to release something. |
Events
Name | Description | |
---|---|---|
AnchorRangeEntered |
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:
| |
AnchorRangeLeft | Same as AnchorRangeEntered but when leaving the valid range. | |
GrabTrying |
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:
| |
ObjectGrabbed | Same as ObjectGrabbing but called right after the object was grabbed. | |
ObjectGrabbing |
Event called whenever a UxrGrabber component is about to grab a UxrGrabbableObject. The following properties from UxrManipulationEventArgs will contain meaningful data:
| |
ObjectPlaced | Same as ObjectPlacing but called right after the object was placed. | |
ObjectPlacing |
Event called whenever a UxrGrabbableObject is about to be placed on an UxrGrabbableObjectAnchor. The following properties from UxrManipulationEventArgs will contain meaningful data:
| |
ObjectReleased | Same as ObjectReleasing but called right after the object was released. | |
ObjectReleasing |
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:
| |
ObjectRemoved | Same as ObjectRemoving but called right after the object was removed. | |
ObjectRemoving |
Event called whenever a UxrGrabbableObject is about to be removed from an UxrGrabbableObjectAnchor. The following properties from UxrManipulationEventArgs will contain meaningful data:
| |
PlacedObjectRangeEntered |
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:
| |
PlacedObjectRangeLeft | Same as PlacedObjectRangeEntered but when leaving the valid range. | |
StateChanged | Event raised when a relevant state of an object changed and requires storage/synchronization. |
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.) |