Haply::Inverse::Unity::CursorBehaviour
Inherits from MonoBehaviour
Inherited by Haply.Inverse.Unity.Inverse3Body, Haply.Inverse.Unity.Inverse3Cursor, Haply.Inverse.Unity.VerseGripCursor
Protected Functions
Name | |
---|---|
virtual void | AddDeviceListeners() Adds listeners to the device. |
virtual void | RemoveDeviceListeners() Removes listeners from the device. |
virtual GameObject | GetModelPrefab() Gets the prefab that should be instantiated upon startup. |
void | UpdateCursor() Updates the cursor every frame if IsUpdateCursorRequired is true. |
virtual void | Awake() |
virtual void | OnEnable() |
void | Update() |
void | FixedUpdate() |
Public Properties
Name | |
---|---|
DeviceBehaviour | Device Device that controls the cursor. |
Transform | ModelPrefab The prefab of a cursor model to show for this cursor that this behaviour automatically instantiates. |
Transform | ModelParent The transform that this behaviour uses as the parent for the model prefab when it is instantiated. |
Transform | Model The instance of the cursor model in the scene. |
bool | HideControllerModel Whether to hide the cursor model. |
float | Radius Gets the Model radius. |
Protected Properties
Name | |
---|---|
bool | IsDeviceSet Indicates whether the Device has been set. |
bool | IsUpdateCursorRequired Indicates whether the UpdateCursor must be called on next FixedUpdate call. |
Protected Functions Documentation
function AddDeviceListeners
virtual void AddDeviceListeners()
Adds listeners to the device.
Reimplemented by: Haply::Inverse::Unity::Inverse3Body::AddDeviceListeners
Should be overridden by derived classes to add custom listeners.
function RemoveDeviceListeners
virtual void RemoveDeviceListeners()
Removes listeners from the device.
Reimplemented by: Haply::Inverse::Unity::Inverse3Body::RemoveDeviceListeners
Should be overridden by derived classes to remove custom listeners.
function GetModelPrefab
virtual GameObject GetModelPrefab()
Gets the prefab that should be instantiated upon startup.
Return: Returns the prefab that should be instantiated upon startup.
function UpdateCursor
void UpdateCursor()
Updates the cursor every frame if IsUpdateCursorRequired is true.
This is called automatically from FixedUpdate.
function Awake
virtual void Awake()
function OnEnable
virtual void OnEnable()
function Update
void Update()
function FixedUpdate
void FixedUpdate()
Public Property Documentation
property Device
DeviceBehaviour Device;
Device that controls the cursor.
Return: Device controlling the cursor.
Set automatically by the device owning the cursor at runtime. Also updates IsDeviceSet flag.
property ModelPrefab
Transform ModelPrefab;
The prefab of a cursor model to show for this cursor that this behaviour automatically instantiates.
See: Model
This behaviour automatically instantiates an instance of the prefab as a child of ModelParent upon startup unless Model is already set, in which case this value is ignored.
property ModelParent
Transform ModelParent;
The transform that this behaviour uses as the parent for the model prefab when it is instantiated.
Automatically instantiated and set in Awake if not already set. Setting this will not automatically destroy the previous object.
property Model
Transform Model;
The instance of the cursor model in the scene.
You can set this to an existing object instead of using ModelPrefab.
If set, it should reference a child GameObject of this behaviour so it will update with the cursor pose.
property HideControllerModel
bool HideControllerModel;
Whether to hide the cursor model.
See: Model
property Radius
float Radius;
Gets the Model radius.
Zero if the cursor is not a PrimitiveType.Sphere.
This value is automatically updated by SetupModel when _performSetup flag is fired.
Protected Property Documentation
property IsDeviceSet
bool IsDeviceSet;
Indicates whether the Device has been set.
This property helps in optimizing checks for the Device's existence, as direct comparisons with null can be expensive in Unity.
property IsUpdateCursorRequired
bool IsUpdateCursorRequired;
Indicates whether the UpdateCursor must be called on next FixedUpdate call.