Chunks
Moddable voxel sandbox for room-scale VR.
Public Member Functions | Public Attributes | Protected Member Functions | Properties | Events | List of all members
Chunks.Interface.Wand Class Reference

Interface for a motion controller. More...

Inheritance diagram for Chunks.Interface.Wand:
Chunks.Entities.Component Chunks.Entities.Object Chunks.Entities.IComponent Chunks.Entities.IObject

Public Member Functions

 Wand ()
 
void ResetParticles ()
 Resets the ambient particle emitter to its default state. More...
 
TTool AddTool< TTool > ()
 Adds a wand tool of the given type to this wand. More...
 
WandTool AddTool (Type type)
 Adds a wand tool of the given type to this wand. More...
 
void AddFavoriteTool< TTool > ()
 
void AddFavoriteTool (Type type)
 
void RemoveFavoriteTool< TTool > ()
 
void RemoveFavoriteTool (Type type)
 
void SwitchToNextFavoriteTool ()
 
bool IsToolFavorited< TTool > ()
 
bool IsToolFavorited (Type type)
 
TTool ActivateTool< TTool > ()
 
WandTool ActivateTool (Type type)
 
Vector GetCursorPosition (float distance=1f/16f)
 Gets the world space position of a point a given relative distance from the front tip of the wand. More...
 
IntVector GetCursorBlockPosition (float distance=1f/16f)
 Gets the world block space position of a point a given relative distance from the front tip of the wand. More...
 
void HapticFeedback (HapticFeedbackType type)
 
void TriggerHapticPulse (int durationMicroSeconds=500)
 Triggers haptic feedback on the controller for the given duration in microseconds. More...
 
void ClearToolTips ()
 Wipes all text from button tool tips on this wand. More...
 
- Public Member Functions inherited from Chunks.Entities.Component
void DestroyComponent ()
 Removes this component from the entity that contains it. More...
 
void DestroyEntity ()
 Removes the entity containing this component from the world, along with any child entities. More...
 
override string ToString ()
 Returns a string representing this component with the format "TypeName (EntityName)." More...
 
- Public Member Functions inherited from Chunks.Entities.Object
Entity CreateChild ()
 Creates a new Entity parented to this one. More...
 
TComponent CreateChildWithComponent< TComponent > ()
 Creates a new Entity parented to this one with a component of the given type, which is returned. More...
 
Entity FindChild (string name, bool recurse=true)
 Attempts to find a child Entity of this one with the given name, and optionally searches recursively through all children. Null is returned if no matches are found. More...
 
TComponent FindChildComponent< TComponent > (string name, bool recurse=true)
 Attempts to find a child Entity of this one with the given name, and optionally searches recursively through all children. If a matching Entity is found, a component of the given type is retrieved from it. Null is returned if no matches are found. More...
 
Entity FindParent (string name)
 Attempts to find an Entity that contains this Object's Entity with the given Name. Returns null if no match is found. More...
 
TComponent FindParentComponent< TComponent > ()
 Attempts to find an Entity that contains this Object's Entity with a component of the given type. If a matching Entity is found, the component of the given type is retrieved from it. Returns null if no match is found. More...
 
TComponent FindParentComponent< TComponent > (string name)
 Attempts to find an Entity that contains this Object's Entity with the given Name. If a matching Entity is found, a component of the given type is retrieved from it. Returns null if no match is found. More...
 
TComponent AddComponent< TComponent > ()
 Adds a component of the specified type to this entity, returning the new component. More...
 
TComponent GetOrAddComponent< TComponent > ()
 Attempts to get a component of the specified type from this entity, adding it if one doesn't already exist. More...
 
TComponent GetComponent< TComponent > ()
 Attempts to get a component of the specified type from this entity, returning null if one doesn't exist. More...
 
IEnumerable< TComponent > GetComponents< TComponent > ()
 Gets all components derived from the given type. More...
 

Public Attributes

const double MenuHoldTime = 0.25
 Amount of time in seconds the application menu is held before all menus are moved to the dock. More...
 
IEnumerable< WandToolAllTools => _tools
 Gets all tools currently associated with this wand. More...
 
IEnumerable< WandToolFavoriteTools => _favoriteTools
 
WandTool CurrentTool => _tools.FirstOrDefault(x => x.IsActive)
 Gets the currently active tool for this wand. More...
 
bool IsInteractingWithMenuPanel => CurrentPointedMenuPanel != null
 
- Public Attributes inherited from Chunks.Entities.Component
override bool IsValid => Behaviour != null
 Tests to see if this component hasn't been removed. More...
 

Protected Member Functions

override void OnInitialize ()
 Called only once, when the component is first attached to an entity and is ready to add or retrieve other components. More...
 
override void OnDestroy ()
 Called when this component is removed, or the parent entity is destroyed. More...
 
override void OnDisable ()
 Called each time this component goes from being enabled to disabled. More...
 
override void OnPhysicsUpdate ()
 Called at a fixed time step for any time dependant physics calculations. More...
 
- Protected Member Functions inherited from Chunks.Entities.Component
object Wait (float timeSeconds)
 Suspends coroutine operation for the given time when yielded. More...
 
object StartCoroutine (IEnumerator routine)
 Starts execution of a coroutine. More...
 
virtual void OnSave (BinaryWriter writer)
 Implement this and OnLoad to enable serialization of this component when the parent entity saves. More...
 
virtual void OnLoad (BinaryReader reader)
 Implement this and OnSave to enable serialization of this component when the parent entity saves. More...
 
virtual void OnEnable ()
 Called each time this component goes from being disabled to enabled. More...
 
virtual void OnUpdate ()
 Called once per world update if this component and its parent entity are enabled. More...
 
virtual void OnPreRender ()
 Called just before the entity containing this component is rendered. More...
 

Properties

ParticleEmitter Particles [get]
 Ambient particle emitter for this wand. More...
 
SoundEmitter Sounds [get]
 
Holder Holder [get]
 
WandHand Hand [get, set]
 
WandModel Model [get, set]
 
Pointer Pointer [get]
 Pointer used for pointing out locations in 3D space. More...
 
WandButton Grip [get]
 Side grip buttons. More...
 
WandButton HairTrigger [get]
 Trigger threshold button. More...
 
WandButton TrackPad [get]
 Track pad button triggered when pressed. More...
 
WandButton TrackPadTouch [get]
 Track pad button triggered when touched. More...
 
WandButton ApplicationMenu [get]
 Application menu (red) button. More...
 
float TriggerValue [get, set]
 Current analogue value of the trigger. More...
 
Vector TrackPadValue [get, set]
 Current touch position on the track pad. More...
 
Vector TrackPadDelta [get, set]
 
Transform RightGripTransform [get]
 Transformation of the right grip button. More...
 
Transform LeftGripTransform [get]
 Transformation of the left grip button. More...
 
Transform TriggerTransform [get]
 Transformation of the trigger. More...
 
Transform TrackPadTransform [get]
 Transformation of the track pad. More...
 
Transform ApplicationMenuTransform [get]
 Transformation of the application menu button. More...
 
ToolTip GripToolTip [get]
 Tool tip used to describe the function of the grips. More...
 
ToolTip TriggerToolTip [get]
 Tool tip used to describe the function of the trigger. More...
 
ToolTip TrackPadToolTip [get]
 Tool tip used to describe the function of the track pad. More...
 
TrackPadDial TrackPadDial [get]
 When enabled, can be used to emulate a rotating dial on the track pad. More...
 
float MenuScrollDelta [get]
 
Vector Velocity [get]
 Last sampled world space velocity of the wand. More...
 
MenuPanel CurrentPointedMenuPanel [get]
 
MenuPanel CurrentHeldMenuPanel [get]
 
MenuPanelRaycastHit CurrentMenuPanelRaycastHit [get]
 
bool HasSnappedHeldMenuPanel [get]
 
Holdable CurrentPointedHoldable [get]
 
- Properties inherited from Chunks.Entities.Component
Entity Entity [get]
 The entity this instance is attached to. More...
 
bool IsSavingImplemented [get]
 If true, OnSave and OnLoad have been implemented for this type. More...
 
bool Enabled [get, set]
 Enabled components will be updated, assuming they are within enabled entities. More...
 
- Properties inherited from Chunks.Entities.Object
abstract bool IsValid [get]
 Tests to see if this object hasn't been removed. More...
 
virtual string Name [get, set]
 Custom name associated with this Object's Entity, used to find the Entity in the hierarchy. More...
 
virtual Transform Transform [get]
 Transformation of this Object's Entity. More...
 
virtual IWorld World [get]
 The IWorld that contains this Object. More...
 
- Properties inherited from Chunks.Entities.IComponent
Entity Entity [get]
 
bool IsSavingImplemented [get]
 
bool Enabled [get, set]
 
- Properties inherited from Chunks.Entities.IObject
bool IsValid [get]
 
string Name [get, set]
 
Transform Transform [get]
 
IWorld World [get]
 

Events

Action< WandFavoriteToolsChanged
 

Detailed Description

Interface for a motion controller.

Constructor & Destructor Documentation

Chunks.Interface.Wand.Wand ( )

Member Function Documentation

WandTool Chunks.Interface.Wand.ActivateTool ( Type  type)
Type Constraints
TTool :WandTool 
void Chunks.Interface.Wand.AddFavoriteTool ( Type  type)
Type Constraints
TTool :WandTool 
WandTool Chunks.Interface.Wand.AddTool ( Type  type)

Adds a wand tool of the given type to this wand.

Parameters
typeType of tool to add
TTool Chunks.Interface.Wand.AddTool< TTool > ( )

Adds a wand tool of the given type to this wand.

Template Parameters
TToolType of tool to add
Type Constraints
TTool :WandTool 
TTool :new() 
void Chunks.Interface.Wand.ClearToolTips ( )

Wipes all text from button tool tips on this wand.

IntVector Chunks.Interface.Wand.GetCursorBlockPosition ( float  distance = 1f / 16f)

Gets the world block space position of a point a given relative distance from the front tip of the wand.

Parameters
scaleWithPlayerIf true, the distance won't be scaled with the player's scale if that scale is below 1
distanceDistance from the wand tip relative to the player's scale
Vector Chunks.Interface.Wand.GetCursorPosition ( float  distance = 1f / 16f)

Gets the world space position of a point a given relative distance from the front tip of the wand.

Parameters
limitScaleIf true, the distance won't be scaled with the player's scale if that scale is below 1
distanceDistance from the wand tip relative to the player's scale
void Chunks.Interface.Wand.HapticFeedback ( HapticFeedbackType  type)
bool Chunks.Interface.Wand.IsToolFavorited ( Type  type)
Type Constraints
TTool :WandTool 
override void Chunks.Interface.Wand.OnDestroy ( )
protectedvirtual

Called when this component is removed, or the parent entity is destroyed.

Reimplemented from Chunks.Entities.Component.

override void Chunks.Interface.Wand.OnDisable ( )
protectedvirtual

Called each time this component goes from being enabled to disabled.

Reimplemented from Chunks.Entities.Component.

override void Chunks.Interface.Wand.OnInitialize ( )
protectedvirtual

Called only once, when the component is first attached to an entity and is ready to add or retrieve other components.

Reimplemented from Chunks.Entities.Component.

override void Chunks.Interface.Wand.OnPhysicsUpdate ( )
protectedvirtual

Called at a fixed time step for any time dependant physics calculations.

Reimplemented from Chunks.Entities.Component.

void Chunks.Interface.Wand.RemoveFavoriteTool ( Type  type)
Type Constraints
TTool :WandTool 
void Chunks.Interface.Wand.ResetParticles ( )

Resets the ambient particle emitter to its default state.

void Chunks.Interface.Wand.SwitchToNextFavoriteTool ( )
void Chunks.Interface.Wand.TriggerHapticPulse ( int  durationMicroSeconds = 500)

Triggers haptic feedback on the controller for the given duration in microseconds.

Parameters
durationMicroSecondsDuration to pulse for

Member Data Documentation

IEnumerable<WandTool> Chunks.Interface.Wand.AllTools => _tools

Gets all tools currently associated with this wand.

WandTool Chunks.Interface.Wand.CurrentTool => _tools.FirstOrDefault(x => x.IsActive)

Gets the currently active tool for this wand.

IEnumerable<WandTool> Chunks.Interface.Wand.FavoriteTools => _favoriteTools
bool Chunks.Interface.Wand.IsInteractingWithMenuPanel => CurrentPointedMenuPanel != null
const double Chunks.Interface.Wand.MenuHoldTime = 0.25

Amount of time in seconds the application menu is held before all menus are moved to the dock.

Property Documentation

WandButton Chunks.Interface.Wand.ApplicationMenu
get

Application menu (red) button.

Transform Chunks.Interface.Wand.ApplicationMenuTransform
get

Transformation of the application menu button.

MenuPanel Chunks.Interface.Wand.CurrentHeldMenuPanel
get
MenuPanelRaycastHit Chunks.Interface.Wand.CurrentMenuPanelRaycastHit
get
Holdable Chunks.Interface.Wand.CurrentPointedHoldable
get
MenuPanel Chunks.Interface.Wand.CurrentPointedMenuPanel
get
WandButton Chunks.Interface.Wand.Grip
get

Side grip buttons.

ToolTip Chunks.Interface.Wand.GripToolTip
get

Tool tip used to describe the function of the grips.

WandButton Chunks.Interface.Wand.HairTrigger
get

Trigger threshold button.

WandHand Chunks.Interface.Wand.Hand
getset
bool Chunks.Interface.Wand.HasSnappedHeldMenuPanel
get
Holder Chunks.Interface.Wand.Holder
get
Transform Chunks.Interface.Wand.LeftGripTransform
get

Transformation of the left grip button.

float Chunks.Interface.Wand.MenuScrollDelta
get
WandModel Chunks.Interface.Wand.Model
getset
ParticleEmitter Chunks.Interface.Wand.Particles
get

Ambient particle emitter for this wand.

Pointer Chunks.Interface.Wand.Pointer
get

Pointer used for pointing out locations in 3D space.

Transform Chunks.Interface.Wand.RightGripTransform
get

Transformation of the right grip button.

SoundEmitter Chunks.Interface.Wand.Sounds
get
WandButton Chunks.Interface.Wand.TrackPad
get

Track pad button triggered when pressed.

Vector Chunks.Interface.Wand.TrackPadDelta
getset
TrackPadDial Chunks.Interface.Wand.TrackPadDial
get

When enabled, can be used to emulate a rotating dial on the track pad.

ToolTip Chunks.Interface.Wand.TrackPadToolTip
get

Tool tip used to describe the function of the track pad.

WandButton Chunks.Interface.Wand.TrackPadTouch
get

Track pad button triggered when touched.

Transform Chunks.Interface.Wand.TrackPadTransform
get

Transformation of the track pad.

Vector Chunks.Interface.Wand.TrackPadValue
getset

Current touch position on the track pad.

ToolTip Chunks.Interface.Wand.TriggerToolTip
get

Tool tip used to describe the function of the trigger.

Transform Chunks.Interface.Wand.TriggerTransform
get

Transformation of the trigger.

float Chunks.Interface.Wand.TriggerValue
getset

Current analogue value of the trigger.

Vector Chunks.Interface.Wand.Velocity
get

Last sampled world space velocity of the wand.

Event Documentation

Action<Wand> Chunks.Interface.Wand.FavoriteToolsChanged

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