Class HVRTeleportCollisonHandler
Handles moving hands and the objects they are holding after a teleport with post collision handling behaviours.
Inheritance
Inherited Members
Namespace: HurricaneVR.Framework.Core.Player
Assembly: HurricaneVR.Framework.dll
Syntax
[RequireComponent(typeof(HVRTeleporter))]
public class HVRTeleportCollisonHandler : MonoBehaviour
Fields
| Improve this Doc View SourceAfterTeleportOption
BoundingBoxSweep: Uses bounding box of all grabbable colliders to to find a safe position between the controller and the ResetTarget transform. DisableCollision: Disables the held object's collision until it's free and clear, releasing the object is prevented until clear.
Declaration
[Tooltip("Post teleport collision handling")]
public AfterTeleportOptions AfterTeleportOption
Field Value
Type | Description |
---|---|
AfterTeleportOptions |
BackoutIncrement
After the hand sweeps from the ResetTarget toward the desired target, the hand will back out when holding an object until it's clear. This defines the amount of each backout incremenet before checking the next Physics.Overlap
Declaration
[Tooltip("When backing out held objects, how granular should each move be when checking for overlap.")]
public float BackoutIncrement
Field Value
Type | Description |
---|---|
System.Single |
GrabbableStuck
Invoked if a held object is overlapping colliders after a teleport when DisableCollision is chosen.
Declaration
[Header("Events")]
public GrabbableStuck GrabbableStuck
Field Value
Type | Description |
---|---|
GrabbableStuck |
GrabbableUnstuck
Invoked once a previously stuck object is clear.
Declaration
public GrabbableStuck GrabbableUnstuck
Field Value
Type | Description |
---|---|
GrabbableStuck |
LayerMask
After teleporting, checks are used against these layers to determine if hand's and held objects are stuck and need to be backed out safely.
Declaration
[Tooltip("Layers that hands and objects can hit after a teleport.")]
public LayerMask LayerMask
Field Value
Type | Description |
---|---|
UnityEngine.LayerMask |
LeftHand
The Left HVRHandGrabber component.
Declaration
public HVRHandGrabber LeftHand
Field Value
Type | Description |
---|---|
HVRHandGrabber |
LeftJointHand
The Left Physics Hand component.
Declaration
public HVRJointHand LeftJointHand
Field Value
Type | Description |
---|---|
HVRJointHand |
LeftTrackers
Declaration
public List<GrabbableCollisionTracker> LeftTrackers
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<GrabbableCollisionTracker> |
ResetTarget
This tranform's position is used as the starting point to safely move the hand toward's the controller after a teleport.
Declaration
[Header("Required Objects")]
[Tooltip("After teleporting, the hand will start at this position and sweep towards the final hand destination")]
public Transform ResetTarget
Field Value
Type | Description |
---|---|
UnityEngine.Transform |
RightHand
The Right HVRHandGrabber component.
Declaration
public HVRHandGrabber RightHand
Field Value
Type | Description |
---|---|
HVRHandGrabber |
RightJointHand
The Right Physics Hand component.
Declaration
public HVRJointHand RightJointHand
Field Value
Type | Description |
---|---|
HVRJointHand |
RightTrackers
Declaration
public List<GrabbableCollisionTracker> RightTrackers
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<GrabbableCollisionTracker> |
StuckTime
Used when AfterTeleportOption is set to DisableCollision, this amount of time must be past after a teleport before checking if the object is stuck.
Declaration
[Tooltip("Time required after teleporting to invoke stuck / unstuck events")]
public float StuckTime
Field Value
Type | Description |
---|---|
System.Single |
VerboseDebug
Drops gizmos lines of the post teleport sweep and bounding box positions to debug issues with collision handling
Declaration
[Header("Debugging")]
public bool VerboseDebug
Field Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceAfterFixedUpdate()
Declaration
protected virtual IEnumerator AfterFixedUpdate()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |
AfterTeleport()
Call after a teleport sequence has completed. Post teleport collision behaviour sequence will execute.
Declaration
public virtual void AfterTeleport()
BeforeTeleport(Vector3)
Called before teleporting to snapshot the hand and held object state, and the position of the player
Declaration
public virtual void BeforeTeleport(Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Vector3 | position | Player controller position before teleporting |
FixedUpdate()
Declaration
protected virtual void FixedUpdate()
IgnoreCollider(Collider, HVRHandGrabber, HVRGrabbable)
Determine if the provided collider should be ignored when doing an overlap check.
Declaration
protected virtual bool IgnoreCollider(Collider c, HVRHandGrabber hand, HVRGrabbable grabbable)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Collider | c | |
HVRHandGrabber | hand | |
HVRGrabbable | grabbable | The grabbable that is being tested for overlapping other geometry |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the provided collider should be ignored |
PostTeleportSweep(HVRHandGrabber, HVRGrabbable, Vector3)
Handles sweeping the hand and grabbable after a teleport sequence.
Declaration
protected virtual void PostTeleportSweep(HVRHandGrabber hand, HVRGrabbable g, Vector3 backoutDirection)
Parameters
Type | Name | Description |
---|---|---|
HVRHandGrabber | hand | |
HVRGrabbable | g | |
UnityEngine.Vector3 | backoutDirection | Direction to reverse the grabbable if it's overlapping something after teleporting. |
Start()
Declaration
protected virtual void Start()
Sweep(HVRHandGrabber)
Sweeps the hand and held grabbable from the ResetTarget towards the hand's current position, then backs out in the opposite direction until clear.
Declaration
public virtual void Sweep(HVRHandGrabber hand)
Parameters
Type | Name | Description |
---|---|---|
HVRHandGrabber | hand |
Sweep(HVRHandGrabber, Vector3)
Sweeps the hand and held grabbable from the ResetTarget towards the target position, then backs out in the opposite direction until clear.
Declaration
public virtual void Sweep(HVRHandGrabber hand, Vector3 target)
Parameters
Type | Name | Description |
---|---|---|
HVRHandGrabber | hand | |
UnityEngine.Vector3 | target | Position that the hand will sweep toward. |
SweepHand(HVRHandGrabber, HVRGrabbable, Vector3)
Sweeps the hand and grabbable from the ResetTarget towards the target position, then backs out in the opposite direction until clear.
Declaration
protected virtual void SweepHand(HVRHandGrabber hand, HVRGrabbable g, Vector3 target)
Parameters
Type | Name | Description |
---|---|---|
HVRHandGrabber | hand | |
HVRGrabbable | g | |
UnityEngine.Vector3 | target | Position that the hand will sweep toward. |
SweepHand(HVRHandGrabber, Vector3)
Sweeps the hand from the ResetTarget towards the target position, then backs out in the opposite direction until clear.
Declaration
protected virtual void SweepHand(HVRHandGrabber hand, Vector3 target)
Parameters
Type | Name | Description |
---|---|---|
HVRHandGrabber | hand | |
UnityEngine.Vector3 | target | Position that the hand will sweep toward. |
TeleportUpdate(Vector3)
Call while a teleport is in progress.
Declaration
public virtual void TeleportUpdate(Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Vector3 | position | Player controller updated position |