Tanoda
Leap.Unity.Examples.WorkstationBehaviourExample Class Reference

This example script constructs behavior for a very specific kind of UI object that can animate out a "workstation" panel when thrown or placed outside of an anchor. More...

Inheritance diagram for Leap.Unity.Examples.WorkstationBehaviourExample:

Public Types

enum  WorkstationState {
  Closed , Traveling , Opening , Open ,
  Closing
}
 

Public Member Functions

void ActivateWorkstation ()
 
void DeactivateWorkstation ()
 
delegate Vector3 WorkstationPositionFunc (Vector3 userEyePosition, Quaternion userEyeRotation, Vector3 workstationObjInitPosition, Vector3 workstationObjInitVelocity, float workstationObjRadius, List< Vector3 > otherWorkstationPositions, List< float > otherWorkstationRadii)
 
delegate Quaternion WorkstationRotationFunc (Vector3 userEyePosition, Vector3 targetWorkstationPosition)
 

Static Public Member Functions

static Vector3 DefaultDetermineWorkstationPosition (Vector3 userEyePosition, Quaternion userEyeRotation, Vector3 workstationObjInitPosition, Vector3 workstationObjInitVelocity, float workstationObjRadius, List< Vector3 > otherWorkstationPositions, List< float > otherWorkstationRadii)
 
static Quaternion DefaultDetermineWorkstationRotation (Vector3 userEyePos, Vector3 workstationPosition)
 

Public Attributes

TransformTweenBehaviour workstationModeTween
 
WorkstationPositionFunc workstationPositionFunc
 The function used to calculate this workstation's target position. By default, will attempt to choose a nearby position approximately in front of the user and in the direction the workstation object is currently traveling, and a position that doesn't overlap with other workstations. The default method is set on Awake(), so it can be overridden in OnEnable() or Start(). More...
 
WorkstationRotationFunc workstationRotationFunc
 The function used to calculate this workstation's target rotation. By default, will make the workstation's forward vector face the camera while aligning its upward vector against gravity. More...
 

Static Public Attributes

const float MAX_SPEED_AS_WORKSTATION = 0.005F
 If the rigidbody of this object moves faster than this speed and the object is in workstation mode, it will exit workstation mode. More...
 
const float MIN_SPEED_TO_ACTIVATE_TRAVELING = 0.5F
 If the rigidbody of this object moves slower than this speed and the object wants to enter workstation mode, it will first pick a target position and travel there. (Otherwise, it will open its workstation in-place.) More...
 

Properties

bool isTraveling [get]
 Gets whether the workstation is currently traveling to a target position to open in workstation mode. Will return false if it is not traveling due to not being in workstation mode or if it has already reached its target position. More...
 
WorkstationState workstationState [get]
 

Detailed Description

This example script constructs behavior for a very specific kind of UI object that can animate out a "workstation" panel when thrown or placed outside of an anchor.

Workstation objects exhibit the following behaviors:

  • Play a tween forwards or backwards when entering or exiting "workstation mode", to open or close an arbitrary transform containing other UI elements.
  • Smoothly fly to a "good" target location and orientation and enter workstation mode when the user throws the anchorable object.
  • Set the anchorable object to kinematic when in workstation mode.
  • Allow the user to adjust the anchorable object's position and rotation in a constrained way while in workstation mode. If the user moves the anchorable object quickly, exit workstation mode.

It is a more complicated example that demonstrates using InteractionBehaviours and AnchorableBehaviours to create novel UI behavior.

Definition at line 37 of file WorkstationBehaviourExample.cs.

Member Enumeration Documentation

◆ WorkstationState

Enumerator
Closed 
Traveling 
Opening 
Open 
Closing 

Definition at line 66 of file WorkstationBehaviourExample.cs.

Member Function Documentation

◆ ActivateWorkstation()

void Leap.Unity.Examples.WorkstationBehaviourExample.ActivateWorkstation ( )

Definition at line 113 of file WorkstationBehaviourExample.cs.

◆ DeactivateWorkstation()

void Leap.Unity.Examples.WorkstationBehaviourExample.DeactivateWorkstation ( )

Definition at line 122 of file WorkstationBehaviourExample.cs.

◆ DefaultDetermineWorkstationPosition()

static Vector3 Leap.Unity.Examples.WorkstationBehaviourExample.DefaultDetermineWorkstationPosition ( Vector3  userEyePosition,
Quaternion  userEyeRotation,
Vector3  workstationObjInitPosition,
Vector3  workstationObjInitVelocity,
float  workstationObjRadius,
List< Vector3 >  otherWorkstationPositions,
List< float >  otherWorkstationRadii 
)
static

Definition at line 312 of file WorkstationBehaviourExample.cs.

◆ DefaultDetermineWorkstationRotation()

static Quaternion Leap.Unity.Examples.WorkstationBehaviourExample.DefaultDetermineWorkstationRotation ( Vector3  userEyePos,
Vector3  workstationPosition 
)
static

Definition at line 363 of file WorkstationBehaviourExample.cs.

◆ WorkstationPositionFunc()

delegate Vector3 Leap.Unity.Examples.WorkstationBehaviourExample.WorkstationPositionFunc ( Vector3  userEyePosition,
Quaternion  userEyeRotation,
Vector3  workstationObjInitPosition,
Vector3  workstationObjInitVelocity,
float  workstationObjRadius,
List< Vector3 >  otherWorkstationPositions,
List< float >  otherWorkstationRadii 
)

◆ WorkstationRotationFunc()

delegate Quaternion Leap.Unity.Examples.WorkstationBehaviourExample.WorkstationRotationFunc ( Vector3  userEyePosition,
Vector3  targetWorkstationPosition 
)

Member Data Documentation

◆ MAX_SPEED_AS_WORKSTATION

const float Leap.Unity.Examples.WorkstationBehaviourExample.MAX_SPEED_AS_WORKSTATION = 0.005F
static

If the rigidbody of this object moves faster than this speed and the object is in workstation mode, it will exit workstation mode.

Definition at line 43 of file WorkstationBehaviourExample.cs.

◆ MIN_SPEED_TO_ACTIVATE_TRAVELING

const float Leap.Unity.Examples.WorkstationBehaviourExample.MIN_SPEED_TO_ACTIVATE_TRAVELING = 0.5F
static

If the rigidbody of this object moves slower than this speed and the object wants to enter workstation mode, it will first pick a target position and travel there. (Otherwise, it will open its workstation in-place.)

Definition at line 50 of file WorkstationBehaviourExample.cs.

◆ workstationModeTween

TransformTweenBehaviour Leap.Unity.Examples.WorkstationBehaviourExample.workstationModeTween

Definition at line 52 of file WorkstationBehaviourExample.cs.

◆ workstationPositionFunc

WorkstationPositionFunc Leap.Unity.Examples.WorkstationBehaviourExample.workstationPositionFunc

The function used to calculate this workstation's target position. By default, will attempt to choose a nearby position approximately in front of the user and in the direction the workstation object is currently traveling, and a position that doesn't overlap with other workstations. The default method is set on Awake(), so it can be overridden in OnEnable() or Start().

Definition at line 285 of file WorkstationBehaviourExample.cs.

◆ workstationRotationFunc

WorkstationRotationFunc Leap.Unity.Examples.WorkstationBehaviourExample.workstationRotationFunc

The function used to calculate this workstation's target rotation. By default, will make the workstation's forward vector face the camera while aligning its upward vector against gravity.

Definition at line 291 of file WorkstationBehaviourExample.cs.

Property Documentation

◆ isTraveling

bool Leap.Unity.Examples.WorkstationBehaviourExample.isTraveling
get

Gets whether the workstation is currently traveling to a target position to open in workstation mode. Will return false if it is not traveling due to not being in workstation mode or if it has already reached its target position.

Definition at line 64 of file WorkstationBehaviourExample.cs.

◆ workstationState

WorkstationState Leap.Unity.Examples.WorkstationBehaviourExample.workstationState
get

Definition at line 67 of file WorkstationBehaviourExample.cs.


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