Class TuringPointer
- Namespace
- Turing.Core.TuringInput
- Assembly
- Turing.Core.dll
[DefaultExecutionOrder(-970)]
public abstract class TuringPointer : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourTuringPointer
- Derived
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.useGUILayoutMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.transformComponent.gameObjectComponent.tagObject.GetInstanceID()Object.GetHashCode()Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
- Extension Methods
Fields
ClickTimeThreshold
The time threshold in seconds to differentiate between a click and drag. If the elapsed time between button press and release is less than the threshold, the action is interpreted as a click. Otherwise it is interpreted as a drag.
[Tooltip("The time threshold in seconds to differentiate between a click and drag. If the elapsed time between button press and release is less than the threshold, the action is interpreted as a click. Otherwise it is interpreted as a drag.")]
public float ClickTimeThreshold
Field Value
DefaultCollisionPlane
Enable whether the pointer will attempt to intersect with a collision plane (e.g. screen plane) if it is not intersecting with UI or in-scene objects.
[Tooltip("Enable whether the pointer will attempt to intersect with a collision plane (e.g. screen plane) if it is not intersecting with UI or in-scene objects.")]
public TuringPointer.CollisionPlane DefaultCollisionPlane
Field Value
Remarks
This feature is useful for pointers such as the mouse in order ensure the mouse cursor is bound to the screen plane by default when it is not intersecting with UI or in-scene objects.
DefaultDragPolicy
[Header("Drag")]
[Tooltip("The drag policy to be used when no object is intersected.")]
public TuringPointer.DragPolicy DefaultDragPolicy
Field Value
EventCamera
The camera that will be used when calculating the pointer's world space pose as well as to process pointer events.
[Tooltip("The camera that will be used when calculating the pointer's world space pose as well as to process pointer events.")]
public TuringCamera EventCamera
Field Value
IgnoreMask
The mask controlling which layers the pointer will ignore. All objects on the specified ignore layers will not receive any pointer events.
[Tooltip("The mask controlling which layers the pointer will ignore. All objects on the specified ignore layers will not receive any pointer events.")]
public LayerMask IgnoreMask
Field Value
- LayerMask
MaxHitDistance
[Header("Collision")]
[Tooltip("The maximum hit distance in meters.")]
public float MaxHitDistance
Field Value
MaxHitRadius
The maximum hit radius in meters.
[Tooltip("The maximum hit radius in meters.")]
[Range(0, 0.1)]
public float MaxHitRadius
Field Value
ObjectDragPolicy
The drag policy to be used by default for non-UI objects.
[Tooltip("The drag policy to be used by default for non-UI objects.")]
public TuringPointer.DragPolicy ObjectDragPolicy
Field Value
OnButtonPressed
Event dispatched when a pointer button becomes pressed.
[Tooltip("Event dispatched when a pointer button becomes pressed.")]
public TuringPointer.IntEvent OnButtonPressed
Field Value
OnButtonPressing
[Tooltip("Event dispatched when a pointer button pressing.")]
public TuringPointer.IntEvent OnButtonPressing
Field Value
OnButtonReleased
Event dispatched when a pointer button becomes released.
[Tooltip("Event dispatched when a pointer button becomes released.")]
public TuringPointer.IntEvent OnButtonReleased
Field Value
OnObjectEntered
[Header("Events")]
[Tooltip("Event dispatched when the pointer enters an object.")]
public TuringPointer.CollisionEvent OnObjectEntered
Field Value
OnObjectExited
Event dispatched when the pointer exits an object.
[Tooltip("Event dispatched when the pointer exits an object.")]
public TuringPointer.CollisionEvent OnObjectExited
Field Value
PriorityMask
A mask specifying which objects take priority when snapping.
[Tooltip("A mask specifying which objects take priority when snapping.")]
public LayerMask PriorityMask
Field Value
- LayerMask
ScriptPriority
public const int ScriptPriority = -970
Field Value
ScrollMetersPerUnit
The conversion factor to convert scroll units to meters.
[Tooltip("The conversion factor to convert scroll units to meters.")]
public float ScrollMetersPerUnit
Field Value
UIDragPolicy
The drag policy to be used by default for UI objects.
[Tooltip("The drag policy to be used by default for UI objects.")]
public TuringPointer.DragPolicy UIDragPolicy
Field Value
Visualization
The visualization to be processed by the pointer.
[Tooltip("The visualization to be processed by the pointer.")]
public TuringPointerVisualization Visualization
Field Value
_buttonState
protected TuringPointer.ButtonState[] _buttonState
Field Value
_captureObject
protected GameObject _captureObject
Field Value
- GameObject
_dragButtonId
protected int _dragButtonId
Field Value
_dragScrollDistance
protected float _dragScrollDistance
Field Value
_enteredObject
protected GameObject _enteredObject
Field Value
- GameObject
_exitedObject
protected GameObject _exitedObject
Field Value
- GameObject
_hitInfo
public RaycastResult _hitInfo
Field Value
- RaycastResult
_pressDragPolicy
protected TuringPointer.DragPolicy _pressDragPolicy
Field Value
_pressHitInfo
protected RaycastResult _pressHitInfo
Field Value
- RaycastResult
_pressInteractable
protected TuringPointerInteractable _pressInteractable
Field Value
_pressLocalHitDirection
protected Vector3 _pressLocalHitDirection
Field Value
- Vector3
_pressLocalHitNormal
protected Vector3 _pressLocalHitNormal
Field Value
- Vector3
_pressLocalHitPosition
protected Vector3 _pressLocalHitPosition
Field Value
- Vector3
_pressObject
protected GameObject _pressObject
Field Value
- GameObject
_pressScreenWorldNormal
protected Vector3 _pressScreenWorldNormal
Field Value
- Vector3
_pressScreenWorldPoseMatrix
protected Matrix4x4 _pressScreenWorldPoseMatrix
Field Value
- Matrix4x4
Properties
AnyButtonPressed
Checks whether any pointer button is currently pressed.
public virtual bool AnyButtonPressed { get; }
Property Value
ButtonCount
The number of buttons supported by the pointer.
public abstract int ButtonCount { get; }
Property Value
DefaultCustomDragPlane
A callback to override the default drag plane.
public Func<TuringPointer, Plane> DefaultCustomDragPlane { get; set; }
Property Value
- Func<TuringPointer, Plane>
DragButtonId
The ID of the button responsible for initiating the current drag operation. If no drag operation is active, the button ID will be -1.
public int DragButtonId { get; }
Property Value
EndPointWorldPose
The pose of the pointer's current end point in world space.
public virtual Pose EndPointWorldPose { get; }
Property Value
- Pose
EnteredObject
The current entered object. If no object has been entered this frame, the entered object will be null.
public GameObject EnteredObject { get; }
Property Value
- GameObject
ExitedObject
The current exited object. If no object has been exited this frame, the exited object will be null.
public GameObject ExitedObject { get; }
Property Value
- GameObject
HitInfo
The current hit information of the pointer.
public RaycastResult HitInfo { get; set; }
Property Value
- RaycastResult
Id
The unique id of the pointer.
public abstract int Id { get; }
Property Value
IsTouchPointer
public virtual bool IsTouchPointer { get; }
Property Value
IsVisible
The current visibility state of the pointer.
public abstract bool IsVisible { get; }
Property Value
PointerRay
The world ray based on the pointer's current position and rotation.
public virtual Ray PointerRay { get; }
Property Value
- Ray
PressHitInfo
The hit information corresponding to when any button is pressed to initiate a drag.
public RaycastResult PressHitInfo { get; }
Property Value
- RaycastResult
ScreenWorldPoseMatrix
protected Matrix4x4 ScreenWorldPoseMatrix { get; }
Property Value
- Matrix4x4
ScrollDelta
The current scroll delta of the pointer.
public abstract Vector2 ScrollDelta { get; }
Property Value
- Vector2
TouchAverageMovement
public virtual Vector2 TouchAverageMovement { get; }
Property Value
- Vector2
TwoFingerMovement
public virtual Vector2 TwoFingerMovement { get; }
Property Value
- Vector2
Methods
Awake()
protected virtual void Awake()
CapturePointer(GameObject)
Allows a specified object to capture pointer events.
public void CapturePointer(GameObject captureObject)
Parameters
captureObjectGameObjectA reference to the GameObject responsible for capturing pointer events.
Remarks
To disable pointer event capture, call this method and pass in null for the capture object.
ComputeWorldPose()
protected abstract Pose ComputeWorldPose()
Returns
- Pose
GetButton(int)
Gets whether the specified button is currently in a pressed state.
public abstract bool GetButton(int id)
Parameters
idintThe id of the button.
Returns
- bool
True if the specified button is pressed. False otherwise.
GetButtonDown(int)
Gets whether the specified button became pressed this frame.
public virtual bool GetButtonDown(int id)
Parameters
idintThe id of the button.
Returns
- bool
True if the specified button became pressed. False otherwise.
GetButtonMapping(int)
Returns the appropriate Unity PointerEventData.InputButton based on a specified integer button id.
public PointerEventData.InputButton GetButtonMapping(int id)
Parameters
idintThe integer button id to retrieve the InputButton for.
Returns
- PointerEventData.InputButton
The InputButton associated with the specified integer button id.
GetButtonUp(int)
Gets whether the specified button became released this frame.
public virtual bool GetButtonUp(int id)
Parameters
idintThe id of the button.
Returns
- bool
True if the specified button became released. False otherwise.
GetDragPolicy(GameObject)
protected TuringPointer.DragPolicy GetDragPolicy(GameObject gameObject)
Parameters
gameObjectGameObject
Returns
GetInstances()
Gets all active pointer instances in the current scene.
public static IList<TuringPointer> GetInstances()
Returns
Remarks
This is a convenience method for any logic that needs to quickly iterate through all active pointers in the scene (e.g. TuringInputModule).
OnDisable()
protected virtual void OnDisable()
OnEnable()
protected virtual void OnEnable()
ProcessButtonPress(int)
protected virtual void ProcessButtonPress(int buttonId)
Parameters
buttonIdint
ProcessButtonRelease(int)
protected void ProcessButtonRelease(int buttonId)
Parameters
buttonIdint
ProcessButtonState()
public virtual void ProcessButtonState()
ProcessCollisions()
protected virtual void ProcessCollisions()
ProcessDrag(ref RaycastResult)
protected void ProcessDrag(ref RaycastResult hitInfo)
Parameters
hitInfoRaycastResult
ProcessDragLockHitPosition(ref RaycastResult)
protected virtual void ProcessDragLockHitPosition(ref RaycastResult hitInfo)
Parameters
hitInfoRaycastResult
ProcessMove()
protected virtual void ProcessMove()
Raycast(Ray)
protected RaycastResult Raycast(Ray ray)
Parameters
rayRay
Returns
- RaycastResult
Start()
protected virtual void Start()
Update()
protected virtual void Update()