Tanoda
Leap.Unity.Interaction.InteractionXRController Class Reference
Inheritance diagram for Leap.Unity.Interaction.InteractionXRController:
Leap.Unity.Interaction.InteractionController Leap.Unity.Interaction.IInternalInteractionController

Public Member Functions

void RefreshControllerConnection ()
 
override Vector3 GetGraspPoint ()
 Returns approximately where the controller is grasping the currently grasped InteractionBehaviour. This method will print an error if the controller is not currently grasping an object. More...
 
override void OnDrawRuntimeGizmos (RuntimeGizmos.RuntimeGizmoDrawer drawer)
 
- Public Member Functions inherited from Leap.Unity.Interaction.InteractionController
void NotifyObjectUnregistered (IInteractionBehaviour intObj)
 
void LockPrimaryHover (InteractionBehaviour intObj)
 Sets the argument interaction object to be the current primary hover of this interaction controller and locks the primary hover state of the interaction controller. primaryHoverLocked More...
 
void ClearHoverTracking ()
 Clears all hover tracking state and fires the hover-end callbacks immediately. If objects are still in the hover radius around this controller and the controller and manager are still active, HoverBegin callbacks will be invoked again on the next fixed frame. More...
 
void ClearHoverTrackingForObject (IInteractionBehaviour intObj)
 Clears the hover tracking state for an object and fires the hover-end callback for that object immediately. More...
 
void ClearPrimaryHoverTracking ()
 Clears primary hover tracking state for the current primary hovered object. More...
 
void EnableSoftContact ()
 
void DisableSoftContact ()
 
void NotifySoftContactCollisionEnter (ContactBone bone, IInteractionBehaviour intObj, Collider collider)
 
void NotifySoftContactCollisionExit (ContactBone bone, IInteractionBehaviour intObj, Collider collider)
 
void NotifyContactBoneCollisionEnter (ContactBone contactBone, IInteractionBehaviour interactionObj)
 
void NotifyContactBoneCollisionStay (ContactBone contactBone, IInteractionBehaviour interactionObj)
 
void NotifyContactBoneCollisionExit (ContactBone contactBone, IInteractionBehaviour interactionObj)
 
void ClearContactTracking ()
 Clears contact state for this controller and fires the appropriate ContactEnd callbacks on currently-contacted interaction objects immediately. More...
 
void ClearContactTrackingForObject (IInteractionBehaviour intObj)
 Clears contact state for the specified object and fires its ContactEnd callbacks immediately. More...
 
abstract Vector3 GetGraspPoint ()
 Returns approximately where the controller is grasping the currently grasped InteractionBehaviour. This method will print an error if the controller is not currently grasping an object. More...
 
bool TryGrasp (IInteractionBehaviour intObj)
 Checks if the provided interaction object can be grasped by this interaction controller in its current state. If so, the controller will initiate a grasp and this method will return true, otherwise this method returns false. More...
 
virtual void SwapGrasp (IInteractionBehaviour replacement)
 Seamlessly swap the currently grasped object for a replacement object. It will behave like the hand released the current object, and then grasped the new object. More...
 
bool ReleaseGrasp ()
 Releases the object this hand is holding and returns true if the hand was holding an object, or false if there was no object to release. The released object will dispatch OnGraspEnd() immediately. The hand is guaranteed not to be holding an object directly after this method is called. More...
 
bool ReleaseGrasp (out IInteractionBehaviour releasedObject)
 As ReleaseGrasp(), but also outputs the released object into releasedObject if the hand successfully released an object. More...
 
bool ReleaseObject (IInteractionBehaviour toRelease)
 Attempts to release this hand's object, but only if the argument object is the object currently grasped by this hand. If the hand was holding the argument object, returns true, otherwise returns false. More...
 
virtual void OnDrawRuntimeGizmos (RuntimeGizmoDrawer drawer)
 By default, this method will draw all of the colliders found in the contactBoneParent hierarchy, or draw the controller's soft contact representation when in soft contact mode. Optionally override this method to modify its behavior. More...
 
void FixedUpdateController ()
 
bool CheckHoverEnd (out HashSet< IInteractionBehaviour > hoverEndedObjects)
 
bool CheckHoverBegin (out HashSet< IInteractionBehaviour > hoverBeganObjects)
 
bool CheckHoverStay (out HashSet< IInteractionBehaviour > hoveredObjects)
 
bool CheckPrimaryHoverEnd (out IInteractionBehaviour primaryHoverEndedObject)
 
bool CheckPrimaryHoverBegin (out IInteractionBehaviour primaryHoverBeganObject)
 
bool CheckPrimaryHoverStay (out IInteractionBehaviour primaryHoveredObject)
 
bool CheckContactEnd (out HashSet< IInteractionBehaviour > contactEndedObjects)
 
bool CheckContactBegin (out HashSet< IInteractionBehaviour > contactBeganObjects)
 
bool CheckContactStay (out HashSet< IInteractionBehaviour > contactedObjects)
 
bool CheckGraspEnd (out IInteractionBehaviour releasedObject)
 
bool CheckGraspBegin (out IInteractionBehaviour newlyGraspedObject)
 
bool CheckGraspHold (out IInteractionBehaviour graspedObject)
 
bool CheckSuspensionBegin (out IInteractionBehaviour suspendedObject)
 
bool CheckSuspensionEnd (out IInteractionBehaviour resumedObject)
 

Public Attributes

float pollConnectionInterval = 2f
 
new List< Transform > primaryHoverPoints
 
Transform graspPoint
 
float maxGraspDistance = 0.06F
 
string graspButtonAxis
 
float graspTimingSlop = 0.10F
 
Func< float > graspAxisOverride = null
 By default, InteractionVRController uses Input.GetAxis(graspButtonAxis) to determine the "depression" state for the grasp button. By setting this value to something other than null, it is possible to modify this behavior to instead retrieve a grasping axis value based on arbitrary code. More...
 
- Public Attributes inherited from Leap.Unity.Interaction.InteractionController
InteractionManager manager
 
Action< InteractionBehaviourOnBeginPrimaryHoveringObject = (intObj) => { }
 Called when this InteractionController begins primarily hovering over an InteractionBehaviour. If the controller transitions to primarily hovering a new object, OnEndPrimaryHoveringObject will first be called on the old object, then OnBeginPrimaryHoveringObject will be called for the new object. More...
 
Action< InteractionBehaviourOnEndPrimaryHoveringObject = (intObj) => { }
 Called when this InteractionController stops primarily hovering over an InteractionBehaviour. If the controller transitions to primarily-hovering a new object, OnEndPrimaryHoveringObject will first be called on the old object, then OnBeginPrimaryHoveringObject will be called for the new object. More...
 
Action< InteractionBehaviourOnStayPrimaryHoveringObject = (intObj) => { }
 Called every (fixed) frame this InteractionController is primarily hovering over an InteractionBehaviour. More...
 
Action OnGraspBegin = () => { }
 Called when the InteractionController begins grasping an object. More...
 
Action OnGraspStay = () => { }
 Called while the InteractionController is grasping an object. More...
 
Action OnGraspEnd = () => { }
 Called when the InteractionController releases an object. More...
 
Action< InteractionControllerOnContactInitialized = (intCtrl) => { }
 Called when contact data is initialized. More...
 
Func< IInteractionBehaviour, bool > customHoverActivityFilter = null
 In addition to standard hover validity checks, you can set this filter property to further filter objects for hover consideration. Only objects for which this function returns true will be hover candidates (if the filter is not null). More...
 

Protected Member Functions

override void Reset ()
 
virtual void OnValidate ()
 
override void Start ()
 
override void fixedUpdateController ()
 Called just before the InteractionController proceeds with its usual FixedUpdate. More...
 
override void onObjectUnregistered (IInteractionBehaviour intObj)
 InteractionVRController doesn't need to do anything when an object is unregistered. More...
 
override void unwarpColliders (Transform primaryHoverPoint, ISpaceComponent warpedSpaceElement)
 Implementing this method is necessary to support curved spaces as rendered by a Leap Graphic Renderer. See InteractionHand for an example implementation. (Implementing this method is optional if you are not using a curved space as rendered by a Leap Graphic Renderer.) More...
 
override bool initContact ()
 Called to initialize contact colliders. See remarks for implementation requirements. More...
 
override void getColliderBoneTargetPositionRotation (int contactBoneIndex, out Vector3 targetPosition, out Quaternion targetRotation)
 If your controller features no moving colliders relative to itself, simply return the desired position and rotation for the given indexed contact bone in the contactBones array. (For example, by recording the local position and local rotation of each contact bone in initContact()). More complex controllers, such as InteractionHand, uses this method to set ContactBone target positions and rotations based on the tracked Leap hand. More...
 
override void fixedUpdateGraspingState ()
 Called every fixed frame if grasping is enabled in the Interaction Manager. More...
 
override bool checkShouldGrasp (out IInteractionBehaviour objectToGrasp)
 Returns whether this controller should grasp an object this fixed frame, and if so, sets objectToGrasp to the object the controller should grasp. More...
 
override bool checkShouldGraspAtemporal (IInteractionBehaviour intObj)
 If the provided object is within range of this VR controller's grasp point and the grasp button is currently held down, this method will manually initiate a grasp and return true. Otherwise, the method returns false. More...
 
override bool checkShouldRelease (out IInteractionBehaviour objectToRelease)
 Returns whether this controller should release an object this fixed frame, and if so, sets objectToRelease to the object the controller should release. More...
 
- Protected Member Functions inherited from Leap.Unity.Interaction.InteractionController
virtual void Reset ()
 
virtual void OnEnable ()
 
virtual void Start ()
 
virtual void OnDisable ()
 
abstract void onObjectUnregistered (IInteractionBehaviour intObj)
 This method is called by the InteractionController when it is notified by the InteractionManager that an InteractionBehaviour has been unregistered from the Interaction Engine. If your controller has any state that remembers or tracks interaction objects, this method should clear that state, because unregistered objects won't receive state updates or callbacks from this controller's Interaction Manager anymore. More...
 
virtual void fixedUpdateController ()
 Called just before the InteractionController proceeds with its usual FixedUpdate. More...
 
abstract void unwarpColliders (Transform primaryHoverPoint, ISpaceComponent warpedSpaceElement)
 Implementing this method is necessary to support curved spaces as rendered by a Leap Graphic Renderer. See InteractionHand for an example implementation. (Implementing this method is optional if you are not using a curved space as rendered by a Leap Graphic Renderer.) More...
 
abstract bool initContact ()
 Called to initialize contact colliders. See remarks for implementation requirements. More...
 
abstract void getColliderBoneTargetPositionRotation (int contactBoneIndex, out Vector3 targetPosition, out Quaternion targetRotation)
 If your controller features no moving colliders relative to itself, simply return the desired position and rotation for the given indexed contact bone in the contactBones array. (For example, by recording the local position and local rotation of each contact bone in initContact()). More complex controllers, such as InteractionHand, uses this method to set ContactBone target positions and rotations based on the tracked Leap hand. More...
 
virtual void onPreEnableSoftContact ()
 Optionally override this method to perform logic just before soft contact is enabled for this controller. More...
 
virtual void onPostDisableSoftContact ()
 Optionally override this method to perform logic just after soft contact is disabled for this controller. More...
 
abstract bool checkShouldGraspAtemporal (IInteractionBehaviour intObj)
 Checks if the provided interaction object can be grasped by this interaction controller in its current state. If so, the controller will initiate a grasp and this method will return true, otherwise this method returns false. More...
 
abstract void fixedUpdateGraspingState ()
 Called every fixed frame if grasping is enabled in the Interaction Manager. More...
 
virtual void onGraspedObjectForciblyReleased (IInteractionBehaviour objectToBeReleased)
 Optionally override this method to perform logic just before a grasped object is released because it is no longer eligible to be grasped by this controller or ReleaseGrasp() was manually called on the controller. More...
 
abstract bool checkShouldGrasp (out IInteractionBehaviour objectToGrasp)
 Returns whether this controller should grasp an object this fixed frame, and if so, sets objectToGrasp to the object the controller should grasp. More...
 
abstract bool checkShouldRelease (out IInteractionBehaviour objectToRelease)
 Returns whether this controller should release an object this fixed frame, and if so, sets objectToRelease to the object the controller should release. More...
 

Properties

bool isUsingCustomTracking [get]
 
string deviceJoystickTokens [get]
 
Chirality chirality [get]
 
bool pollConnection [get, set]
 Whether to continuously poll attached joystick data for a joystick that matches the device joystick tokens, using Input.GetJoystickNames(). This call allocates garbage, so be wary of setting a low polling interval. More...
 
List< GameObject > enableObjectsOnlyWhenTracked [get]
 These objects will be made active only while the controller is tracked. For more fine-tuned behavior, we recommend implementing your own logic. More...
 
bool isJoystickDetected [get]
 Whether the device joystick tokens matched an entry in Input.GetJoystickNames(). If pollConnection is set to true, this status is refreshed periodically based on the pollConnectionInterval, but only while the joystick tokens have not been detected from Input.GetJoystickNames(). Call RefreshControllerConnection() to detect if the controller has been disconnected. More...
 
IXRControllerTrackingProvider trackingProvider [get, set]
 
override bool isTracked [get]
 Gets whether or not the underlying controller is currently tracked and any joystick token filtering has confirmed that this controller has been detected as a connected joystick. More...
 
override bool isBeingMoved [get]
 Gets whether or not the underlying controller is currently being moved in world space, but relative to the Interaction Manager's transform. The Interaction Manager is usually a sibling of the main camera beneath the camera rig transform, so that if your application is only translating the player rig in space, this method won't incorrectly return true. More...
 
VRNode xrNode [get]
 Gets the XRNode associated with this XR controller. Note: If the tracking mode for this controller is specified as ControllerTrackingMode.Custom, this value may be ignored. More...
 
override bool isLeft [get]
 Gets whether the controller is a left-hand controller. More...
 
override Vector3 position [get]
 Gets the last-tracked position of the controller. More...
 
override Quaternion rotation [get]
 Gets the last-tracked rotation of the controller. More...
 
override Vector3 velocity [get]
 Gets the current velocity of the controller. More...
 
override ControllerType controllerType [get]
 Gets the type of controller this is. For InteractionVRController, the type is always ControllerType.VRController. More...
 
override InteractionHand intHand [get]
 This implementation of InteractionControllerBase does not represent a Leap hand, so it need not return an InteractionHand object. More...
 
override Vector3 hoverPoint [get]
 Gets the center point used for hover distance checking. More...
 
override List< Transform > _primaryHoverPoints [get]
 Gets the list of points to be used to perform higher-fidelity "primary hover" checks. Only one interaction object may be the primary hover of an interaction controller (Leap hand or otherwise) at a time. Interface objects such as buttons can only be pressed when they are primarily hovered by an interaction controller, so it's best to return points on whatever you expect to be able to use to push buttons with the controller. More...
 
override ContactBone[] contactBones [get]
 
override GameObject contactBoneParent [get]
 
float graspDepressedValue [get, set]
 The value between 0 and 1 past which the grasping axis value will cause an attempt to grasp a graspable interaction object near the grasp point. More...
 
float graspReleasedValue [get, set]
 If the grasping axis value passes the graspDepressedValue, it must then drop underneath this value in order to release the grasp attempt (potentially releasing a held object) and allow a new grasp attempt to occur. More...
 
override List< Vector3 > graspManipulatorPoints [get]
 Gets a list returning this controller's hoverPoint. Because the InteractionVRController represents a rigid controller, any two points that rigidly move with the controller position and orientation will provide enough information. More...
 
- Properties inherited from Leap.Unity.Interaction.InteractionController
bool hoverEnabled [get, set]
 
bool contactEnabled [get, set]
 
bool graspingEnabled [get, set]
 
abstract bool isTracked [get]
 Gets whether the underlying object (Leap hand or a held controller) is currently in a tracked state. Objects grasped by a controller that becomes untracked will become "suspended" and receive specific suspension callbacks. (Implementing any behaviour during the suspension state is left up to the developer, however.) More...
 
abstract bool isBeingMoved [get]
 Gets whether the underlying object (Leap hand or a held controller) is currently being moved or being actively manipulated by the player. More...
 
abstract bool isLeft [get]
 Gets whether the underlying object (Leap hand or a held controller) represents or is held by a left hand (true) or a right hand (false). More...
 
bool isRight [get]
 Gets whether the underlying object (Leap hand or a held controller) represents or is held by a right hand (true) or a left hand (false). More...
 
abstract Vector3 position [get]
 Returns the current position of this controller. More...
 
abstract Quaternion rotation [get]
 Returns the current rotation of this controller. More...
 
abstract Vector3 velocity [get]
 Returns the current velocity of this controller. More...
 
abstract ControllerType controllerType [get]
 Gets the type of controller this object represents underneath the InteractionController abstraction. If the type is ControllerType.Hand, the intHand property will contain the InteractionHand object this object abstracts from. More...
 
abstract InteractionHand intHand [get]
 If this InteractionController's controllerType is ControllerType.Hand, this gets the InteractionHand, otherwise this returns null. More...
 
float scale [get]
 Contact requires knowledge of the controller's scale. Non-uniformly scaled controllers are NOT supported. More...
 
ActivityManager< IInteractionBehaviourhoverActivityManager [get]
 
bool primaryHoverLocked [get, set]
 When set to true, locks the current primarily hovered object, even if the hand gets closer to a different object. More...
 
abstract Vector3 hoverPoint [get]
 Gets the current position to check against nearby objects for hovering. Position is only used if the controller is currently tracked. For example, InteractionHand returns the center of the palm of the underlying Leap hand. More...
 
ReadonlyHashSet< IInteractionBehaviourhoveredObjects [get]
 Returns a set of all Interaction objects currently hovered by this InteractionController. More...
 
abstract List< Transform > _primaryHoverPoints [get]
 
ReadonlyList< Transform > primaryHoverPoints [get]
 Gets the list of Transforms to consider against nearby objects to determine the closest object (primary hover) of this controller. More...
 
bool isPrimaryHovering [get]
 Gets whether the InteractionController is currently primarily hovering over any interaction object. More...
 
IInteractionBehaviour primaryHoveredObject [get]
 Gets the InteractionBehaviour that is currently this InteractionController's primary hovered object, if there is one. More...
 
float primaryHoverDistance [get]
 Gets the distance from the closest primary hover point on this controller to its primarily hovered object, if there are any. More...
 
Vector3 primaryHoveringPoint [get]
 Gets the position of the primary hovering point that is closest to its primary hovered object, if this controller has a primary hover. Otherwise, returns Vector3.zero. More...
 
int primaryHoveringPointIndex [get]
 Gets the index in the primaryHoverPoints array of the primary hover point that is currently closest to this controller's primary hover object. More...
 
ReadonlyHashSet< IInteractionBehaviourcontactingObjects [get]
 Gets the set of interaction objects that are currently touching this interaction controller. More...
 
float softContactDislocationDistance [get, set]
 
static PhysicMaterial defaultContactBoneMaterial [get]
 
bool _wasContactInitialized [get]
 
abstract ContactBone[] contactBones [get]
 
abstract GameObject contactBoneParent [get]
 
bool softContactEnabled [get]
 
bool isGraspingObject [get]
 Gets whether the controller is currently grasping an object. More...
 
IInteractionBehaviour graspedObject [get]
 Gets the object the controller is currently grasping, or null if there is no such object. More...
 
ReadonlyHashSet< IInteractionBehaviourgraspCandidates [get]
 Gets the set of objects currently considered graspable. More...
 
abstract List< Vector3 > graspManipulatorPoints [get]
 Gets the points of the controller to add to the calculation to determine how held objects should move as the controller moves. Interaction Controllers utilize the Kabsch algorithm to determine this, which is most noticeable when using Leap hands via InteractionHands to manipulate held objects. Rigid controllers may simply return a single rigid point on the controller. Refer to InteractionHand for a reference implementation for dynamic controllers (e.g. hands). More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Leap.Unity.Interaction.InteractionController
static float GetHoverDistance (Vector3 hoverPoint, IInteractionBehaviour behaviour)
 Returns the hover distance from the hoverPoint to the specified object, automatically accounting for ISpaceComponent warping if necessary. More...
 
static Vector3 TransformPoint (Vector3 worldPoint, ISpaceComponent element)
 Applies the spatial warping of the provided ISpaceComponent to a world-space point. More...
 
static void ReleaseGrasps (IInteractionBehaviour graspedObj, ReadonlyHashSet< InteractionController > controllers)
 Helper static method for forcing multiple controllers to release their grasps on a single object simultaneously. All of the provided controllers must be grasping the argument interaction object. More...
 
- Static Protected Member Functions inherited from Leap.Unity.Interaction.InteractionController
static void drawHoverPoint (RuntimeGizmoDrawer drawer, Vector3 pos)
 
static void drawPrimaryHoverPoint (RuntimeGizmoDrawer drawer, Vector3 pos)
 
- Protected Attributes inherited from Leap.Unity.Interaction.InteractionController
float lastObjectTouchedAdjustedMassMass = 0.2f
 
- Static Protected Attributes inherited from Leap.Unity.Interaction.InteractionController
const float DEAD_ZONE_FRACTION = 0.04F
 

Detailed Description

Definition at line 27 of file InteractionXRController.cs.

Member Function Documentation

◆ checkShouldGrasp()

override bool Leap.Unity.Interaction.InteractionXRController.checkShouldGrasp ( out IInteractionBehaviour  objectToGrasp)
protectedvirtual

Returns whether this controller should grasp an object this fixed frame, and if so, sets objectToGrasp to the object the controller should grasp.

Implements Leap.Unity.Interaction.InteractionController.

Definition at line 792 of file InteractionXRController.cs.

◆ checkShouldGraspAtemporal()

override bool Leap.Unity.Interaction.InteractionXRController.checkShouldGraspAtemporal ( IInteractionBehaviour  intObj)
protectedvirtual

If the provided object is within range of this VR controller's grasp point and the grasp button is currently held down, this method will manually initiate a grasp and return true. Otherwise, the method returns false.

Implements Leap.Unity.Interaction.InteractionController.

Definition at line 808 of file InteractionXRController.cs.

◆ checkShouldRelease()

override bool Leap.Unity.Interaction.InteractionXRController.checkShouldRelease ( out IInteractionBehaviour  objectToRelease)
protectedvirtual

Returns whether this controller should release an object this fixed frame, and if so, sets objectToRelease to the object the controller should release.

Implements Leap.Unity.Interaction.InteractionController.

Definition at line 826 of file InteractionXRController.cs.

◆ fixedUpdateController()

override void Leap.Unity.Interaction.InteractionXRController.fixedUpdateController ( )
protectedvirtual

Called just before the InteractionController proceeds with its usual FixedUpdate.

It's generally better to override this method instead of having your InteractionController implement FixedUpdate because its execution order relative to the Interaction Manager is fixed.

Reimplemented from Leap.Unity.Interaction.InteractionController.

Definition at line 180 of file InteractionXRController.cs.

◆ fixedUpdateGraspingState()

override void Leap.Unity.Interaction.InteractionXRController.fixedUpdateGraspingState ( )
protectedvirtual

Called every fixed frame if grasping is enabled in the Interaction Manager.

graspActivityManager.ActiveObjects will contain objects around the hoverPoint within the grasping radius – in other words, objects eligible to be grasped by the controller. Refer to it to avoid checking grasp eligibility against all graspable objects in your scene.

Implements Leap.Unity.Interaction.InteractionController.

Definition at line 705 of file InteractionXRController.cs.

◆ getColliderBoneTargetPositionRotation()

override void Leap.Unity.Interaction.InteractionXRController.getColliderBoneTargetPositionRotation ( int  contactBoneIndex,
out Vector3  targetPosition,
out Quaternion  targetRotation 
)
protectedvirtual

If your controller features no moving colliders relative to itself, simply return the desired position and rotation for the given indexed contact bone in the contactBones array. (For example, by recording the local position and local rotation of each contact bone in initContact()). More complex controllers, such as InteractionHand, uses this method to set ContactBone target positions and rotations based on the tracked Leap hand.

Implements Leap.Unity.Interaction.InteractionController.

Definition at line 631 of file InteractionXRController.cs.

◆ GetGraspPoint()

override Vector3 Leap.Unity.Interaction.InteractionXRController.GetGraspPoint ( )
virtual

Returns approximately where the controller is grasping the currently grasped InteractionBehaviour. This method will print an error if the controller is not currently grasping an object.

Implements Leap.Unity.Interaction.InteractionController.

Definition at line 701 of file InteractionXRController.cs.

◆ initContact()

override bool Leap.Unity.Interaction.InteractionXRController.initContact ( )
protectedvirtual

Called to initialize contact colliders. See remarks for implementation requirements.

initContact() should:

  • Return false at any time if initialization cannot be performed.
  • Ensure the "contactBones" property returns all contact colliders.
    • (Construct contact colliders if they don't already exist.)
  • Ensure the "contactBoneParent" property returns the common parent of all contact colliders.
    • (Construct the contact bone parent if it doesn't already exist.)
  • Return true if initialization was successful.

Contact will only begin updating after initialization succeeds, otherwise it will try to initialize again on the next fixed frame.

After initialization, the contact bone parent's layer will be set to the Interaction Manager's contactBoneLayer.

Implements Leap.Unity.Interaction.InteractionController.

Definition at line 537 of file InteractionXRController.cs.

◆ OnDrawRuntimeGizmos()

override void Leap.Unity.Interaction.InteractionXRController.OnDrawRuntimeGizmos ( RuntimeGizmos.RuntimeGizmoDrawer  drawer)

Definition at line 839 of file InteractionXRController.cs.

◆ onObjectUnregistered()

override void Leap.Unity.Interaction.InteractionXRController.onObjectUnregistered ( IInteractionBehaviour  intObj)
protectedvirtual

InteractionVRController doesn't need to do anything when an object is unregistered.

Implements Leap.Unity.Interaction.InteractionController.

Definition at line 469 of file InteractionXRController.cs.

◆ OnValidate()

virtual void Leap.Unity.Interaction.InteractionXRController.OnValidate ( )
protectedvirtual

Definition at line 170 of file InteractionXRController.cs.

◆ RefreshControllerConnection()

void Leap.Unity.Interaction.InteractionXRController.RefreshControllerConnection ( )

Definition at line 230 of file InteractionXRController.cs.

◆ Reset()

override void Leap.Unity.Interaction.InteractionXRController.Reset ( )
protectedvirtual

Reimplemented from Leap.Unity.Interaction.InteractionController.

Definition at line 154 of file InteractionXRController.cs.

◆ Start()

override void Leap.Unity.Interaction.InteractionXRController.Start ( )
protectedvirtual

Reimplemented from Leap.Unity.Interaction.InteractionController.

Definition at line 174 of file InteractionXRController.cs.

◆ unwarpColliders()

override void Leap.Unity.Interaction.InteractionXRController.unwarpColliders ( Transform  primaryHoverPoint,
ISpaceComponent  warpedSpaceElement 
)
protectedvirtual

Implementing this method is necessary to support curved spaces as rendered by a Leap Graphic Renderer. See InteractionHand for an example implementation. (Implementing this method is optional if you are not using a curved space as rendered by a Leap Graphic Renderer.)

Warps the collider transforms of this controller by the inverse of the transformation that is applied on the provided warpedSpaceElement, using the primaryHoverPoint as the pivot transform for the transformation.

ITransformer.WorldSpaceUnwarp is a useful method here. (ISpaceComponents contain references to their transformers via their anchors.)

ISpaceComponents denote game objects whose visual positions are warped from rectilinear (non-warped) space into a curved space (via, for example, a LeapCylindricalSpace, which can only be rendered correctly by the Leap Graphic Renderer). This method reverses that transformation for the hand, bringing it into the object's rectilinear space, allowing objects curved in this way to correctly collide with the bones in the hand or collider of a held controller.

The provided Transform is the closest primary hover point to any given primary hover candidate, so it is used as the pivot point for unwarping the colliders of this InteractionController.

Implements Leap.Unity.Interaction.InteractionController.

Definition at line 498 of file InteractionXRController.cs.

Member Data Documentation

◆ graspAxisOverride

Func<float> Leap.Unity.Interaction.InteractionXRController.graspAxisOverride = null

By default, InteractionVRController uses Input.GetAxis(graspButtonAxis) to determine the "depression" state for the grasp button. By setting this value to something other than null, it is possible to modify this behavior to instead retrieve a grasping axis value based on arbitrary code.

A grasp is attempted when the grasp button axis value returned by this method becomes larger than the graspButtonDepressedValue, and a grasp is released when the grasp button axis value returned by this method becomes smaller than the graspButtonReleasedValue. Both of these values provide public setters.

Definition at line 653 of file InteractionXRController.cs.

◆ graspButtonAxis

string Leap.Unity.Interaction.InteractionXRController.graspButtonAxis

Definition at line 119 of file InteractionXRController.cs.

◆ graspPoint

Transform Leap.Unity.Interaction.InteractionXRController.graspPoint

Definition at line 113 of file InteractionXRController.cs.

◆ graspTimingSlop

float Leap.Unity.Interaction.InteractionXRController.graspTimingSlop = 0.10F

Definition at line 126 of file InteractionXRController.cs.

◆ maxGraspDistance

float Leap.Unity.Interaction.InteractionXRController.maxGraspDistance = 0.06F

Definition at line 115 of file InteractionXRController.cs.

◆ pollConnectionInterval

float Leap.Unity.Interaction.InteractionXRController.pollConnectionInterval = 2f

Definition at line 84 of file InteractionXRController.cs.

◆ primaryHoverPoints

new List<Transform> Leap.Unity.Interaction.InteractionXRController.primaryHoverPoints

Definition at line 105 of file InteractionXRController.cs.

Property Documentation

◆ _primaryHoverPoints

override List<Transform> Leap.Unity.Interaction.InteractionXRController._primaryHoverPoints
getprotected

Gets the list of points to be used to perform higher-fidelity "primary hover" checks. Only one interaction object may be the primary hover of an interaction controller (Leap hand or otherwise) at a time. Interface objects such as buttons can only be pressed when they are primarily hovered by an interaction controller, so it's best to return points on whatever you expect to be able to use to push buttons with the controller.

Definition at line 490 of file InteractionXRController.cs.

◆ chirality

Chirality Leap.Unity.Interaction.InteractionXRController.chirality
get

Definition at line 58 of file InteractionXRController.cs.

◆ contactBoneParent

override GameObject Leap.Unity.Interaction.InteractionXRController.contactBoneParent
getprotected

Definition at line 533 of file InteractionXRController.cs.

◆ contactBones

override ContactBone [] Leap.Unity.Interaction.InteractionXRController.contactBones
get

Definition at line 528 of file InteractionXRController.cs.

◆ controllerType

override ControllerType Leap.Unity.Interaction.InteractionXRController.controllerType
get

Gets the type of controller this is. For InteractionVRController, the type is always ControllerType.VRController.

Definition at line 453 of file InteractionXRController.cs.

◆ deviceJoystickTokens

string Leap.Unity.Interaction.InteractionXRController.deviceJoystickTokens
get

Definition at line 51 of file InteractionXRController.cs.

◆ enableObjectsOnlyWhenTracked

List<GameObject> Leap.Unity.Interaction.InteractionXRController.enableObjectsOnlyWhenTracked
get

These objects will be made active only while the controller is tracked. For more fine-tuned behavior, we recommend implementing your own logic.

controller.isJoystickDetected and controller.isTracked are useful for this.

Definition at line 141 of file InteractionXRController.cs.

◆ graspDepressedValue

float Leap.Unity.Interaction.InteractionXRController.graspDepressedValue
getset

The value between 0 and 1 past which the grasping axis value will cause an attempt to grasp a graspable interaction object near the grasp point.

Definition at line 660 of file InteractionXRController.cs.

◆ graspManipulatorPoints

override List<Vector3> Leap.Unity.Interaction.InteractionXRController.graspManipulatorPoints
get

Gets a list returning this controller's hoverPoint. Because the InteractionVRController represents a rigid controller, any two points that rigidly move with the controller position and orientation will provide enough information.

Definition at line 683 of file InteractionXRController.cs.

◆ graspReleasedValue

float Leap.Unity.Interaction.InteractionXRController.graspReleasedValue
getset

If the grasping axis value passes the graspDepressedValue, it must then drop underneath this value in order to release the grasp attempt (potentially releasing a held object) and allow a new grasp attempt to occur.

Definition at line 671 of file InteractionXRController.cs.

◆ hoverPoint

override Vector3 Leap.Unity.Interaction.InteractionXRController.hoverPoint
get

Gets the center point used for hover distance checking.

Definition at line 478 of file InteractionXRController.cs.

◆ intHand

override InteractionHand Leap.Unity.Interaction.InteractionXRController.intHand
get

This implementation of InteractionControllerBase does not represent a Leap hand, so it need not return an InteractionHand object.

Definition at line 461 of file InteractionXRController.cs.

◆ isBeingMoved

override bool Leap.Unity.Interaction.InteractionXRController.isBeingMoved
get

Gets whether or not the underlying controller is currently being moved in world space, but relative to the Interaction Manager's transform. The Interaction Manager is usually a sibling of the main camera beneath the camera rig transform, so that if your application is only translating the player rig in space, this method won't incorrectly return true.

Definition at line 388 of file InteractionXRController.cs.

◆ isJoystickDetected

bool Leap.Unity.Interaction.InteractionXRController.isJoystickDetected
get

Whether the device joystick tokens matched an entry in Input.GetJoystickNames(). If pollConnection is set to true, this status is refreshed periodically based on the pollConnectionInterval, but only while the joystick tokens have not been detected from Input.GetJoystickNames(). Call RefreshControllerConnection() to detect if the controller has been disconnected.

Joystick detection is skipped if deviceJoystickTokens is null or empty, causing this check to always return true.

Definition at line 212 of file InteractionXRController.cs.

◆ isLeft

override bool Leap.Unity.Interaction.InteractionXRController.isLeft
get

Gets whether the controller is a left-hand controller.

Definition at line 413 of file InteractionXRController.cs.

◆ isTracked

override bool Leap.Unity.Interaction.InteractionXRController.isTracked
get

Gets whether or not the underlying controller is currently tracked and any joystick token filtering has confirmed that this controller has been detected as a connected joystick.

Definition at line 375 of file InteractionXRController.cs.

◆ isUsingCustomTracking

bool Leap.Unity.Interaction.InteractionXRController.isUsingCustomTracking
get

Definition at line 42 of file InteractionXRController.cs.

◆ pollConnection

bool Leap.Unity.Interaction.InteractionXRController.pollConnection
getset

Whether to continuously poll attached joystick data for a joystick that matches the device joystick tokens, using Input.GetJoystickNames(). This call allocates garbage, so be wary of setting a low polling interval.

The connection is polled only until a joystick is detected to minimize allocation. Once a joystick has been detected (isJoystickDetected), you must manually call RefreshControllerConnection() to check if the joystick is no longer detected.

Definition at line 75 of file InteractionXRController.cs.

◆ position

override Vector3 Leap.Unity.Interaction.InteractionXRController.position
get

Gets the last-tracked position of the controller.

Definition at line 420 of file InteractionXRController.cs.

◆ rotation

override Quaternion Leap.Unity.Interaction.InteractionXRController.rotation
get

Gets the last-tracked rotation of the controller.

Definition at line 429 of file InteractionXRController.cs.

◆ trackingProvider

IXRControllerTrackingProvider Leap.Unity.Interaction.InteractionXRController.trackingProvider
getset

Definition at line 255 of file InteractionXRController.cs.

◆ velocity

override Vector3 Leap.Unity.Interaction.InteractionXRController.velocity
get

Gets the current velocity of the controller.

Definition at line 438 of file InteractionXRController.cs.

◆ xrNode

VRNode Leap.Unity.Interaction.InteractionXRController.xrNode
get

Gets the XRNode associated with this XR controller. Note: If the tracking mode for this controller is specified as ControllerTrackingMode.Custom, this value may be ignored.

Definition at line 405 of file InteractionXRController.cs.


The documentation for this class was generated from the following file: