Edit

Share via


BaseCursor Class

Definition

Object that represents a cursor in 3D space.

public ref class BaseCursor : UnityEngine::MonoBehaviour, Microsoft::MixedReality::Toolkit::Input::IMixedRealityCursor, UnityEngine::EventSystems::IEventSystemHandler
[UnityEngine.AddComponentMenu("Scripts/MRTK/SDK/BaseCursor")]
public class BaseCursor : UnityEngine.MonoBehaviour, Microsoft.MixedReality.Toolkit.Input.IMixedRealityCursor, UnityEngine.EventSystems.IEventSystemHandler
[<UnityEngine.AddComponentMenu("Scripts/MRTK/SDK/BaseCursor")>]
type BaseCursor = class
    inherit MonoBehaviour
    interface IMixedRealityCursor
    interface IMixedRealityFocusChangedHandler
    interface IEventSystemHandler
    interface IMixedRealitySourceStateHandler
    interface IMixedRealityPointerHandler
Public Class BaseCursor
Inherits MonoBehaviour
Implements IEventSystemHandler, IMixedRealityCursor
Inheritance
UnityEngine.MonoBehaviour
BaseCursor
Derived
Attributes
UnityEngine.AddComponentMenuAttribute
Implements

Constructors

BaseCursor()

Fields

PrimaryCursorVisual
SourceDownIds
TargetedObject
targetPosition
targetRotation
targetScale

Properties

CursorAngularScale
Obsolete.

The angular scale of cursor in relation to Main Camera, assuming a mesh with bounds of Vector3(1,1,1)

CursorAngularSize

The angular size of cursor in relation to Main Camera, assuming a mesh with bounds of Vector3(1,1,1)

CursorContext
CursorState
DefaultCursorDistance

The maximum distance the cursor can be with nothing hit

GameObjectReference

Returns the IMixedRealityCursor's GameObject reference.

IsPointerDown
IsPointerValid

Checks whether the associated pointer is null, and if the pointer is a UnityEngine.Object it also checks whether it has been destroyed.

IsSourceDetected
IsVisible

Is the cursor currently visible?

LocalScale

Local scale of the IMixedRealityCursor.

LookRotationBlend

Blend value for surface normal to user facing lerp.

Pointer

The IMixedRealityPointer this IMixedRealityCursor is associated with.

Position

Position of the IMixedRealityCursor.

PositionLerpTime

Blend value for surface normal to user facing lerp.

ResizeCursorWithDistance

Dictates whether the cursor should resize based on distance. If true, cursor will appear to be the same size no matter what distance it is from Main Camera.

Rotation

Rotation of the IMixedRealityCursor.

RotationLerpTime

Blend value for surface normal to user facing lerp.

ScaleLerpTime

Blend value for surface normal to user facing lerp.

SetVisibilityOnSourceDetected

Sets the visibility of the IMixedRealityCursor when the source is detected.

SurfaceCursorDistance
UseUnscaledTime

When lerping, use unscaled time. This is useful for games that have a pause mechanism or otherwise adjust the game timescale.

VisibleSourcesCount

Methods

CheckCursorContext()

Virtual function for checking cursor context changes.

CheckCursorState()

Virtual function for checking state changes.

Destroy()

Utility method to destroy cursor dependencies (e.g. event subscriptions) in the system explicitly in the middle update loop. This is a "replacement" of Unity OnDestroy. Relying on Unity OnDestroy may cause event handler subscription to become invalid at the point of destroying.

LerpToTargetTransform()
OnBeforeFocusChange(FocusEventData)

Focus event that is raised before the focus is actually changed.

OnCursorContextChange(CursorContextEnum)

Change the cursor context state to the new context. Override in cursor implementations.

OnCursorStateChange(CursorStateEnum)

Change the cursor state to the new state. Override in cursor implementations.

OnDisable()
OnEnable()
OnFocusChanged(FocusEventData)

Focus event that is raised when the focused object is changed.

OnInputDisabled()

Disable input and set to contextual to override input

OnInputEnabled()

Enable input and set to none to reset cursor

OnPointerClicked(MixedRealityPointerEventData)

When a pointer clicked event is raised, this method is used to pass along the event data to the input handler.

OnPointerDown(MixedRealityPointerEventData)

When a pointer down event is raised, this method is used to pass along the event data to the input handler.

OnPointerDragged(MixedRealityPointerEventData)

Called every frame a pointer is down. Can be used to implement drag-like behaviors.

OnPointerUp(MixedRealityPointerEventData)

When a pointer up event is raised, this method is used to pass along the event data to the input handler.

OnSourceDetected(SourceStateEventData)

Raised when a source is detected.

OnSourceLost(SourceStateEventData)

Raised when a source is lost.

RegisterManagers()

Register to events from the managers the cursor needs.

SetVisibility(Boolean)
SnapToTargetTransform()
Start()
UnregisterManagers()

Unregister from events from the managers the cursor needs.

UpdateCursorTransform()

Update the cursor's transform

Applies to