Skip to main content
Version: 2.2.0

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 voidAddDeviceListeners()
Adds listeners to the device.
virtual voidRemoveDeviceListeners()
Removes listeners from the device.
virtual GameObjectGetModelPrefab()
Gets the prefab that should be instantiated upon startup.
voidUpdateCursor()
Updates the cursor every frame if IsUpdateCursorRequired is true.
virtual voidAwake()
virtual voidOnEnable()
voidUpdate()
voidFixedUpdate()

Public Properties

Name
DeviceBehaviourDevice
Device that controls the cursor.
TransformModelPrefab
The prefab of a cursor model to show for this cursor that this behaviour automatically instantiates.
TransformModelParent
The transform that this behaviour uses as the parent for the model prefab when it is instantiated.
TransformModel
The instance of the cursor model in the scene.
boolHideControllerModel
Whether to hide the cursor model.
floatRadius
Gets the Model radius.

Protected Properties

Name
boolIsDeviceSet
Indicates whether the Device has been set.
boolIsUpdateCursorRequired
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.