class MAGES::Interaction::Interactors::SimpleUIInteractor¶
Overview¶
A simple interactor for UI elements. More…
class SimpleUIInteractor: public MonoBehaviour, public MAGES::Interaction::ILineRenderable { public: // enums enum Input; // properties Input InputSource; Transform Origin; float Distance; GameObject Reticle; bool ShowLineVisualOnlyWhenPointingUI; bool IsPointerOverUI; // methods void BeginSelection(); void EndSelection(); virtual bool TryGetHitPoint( out Vector3 hitPosition, out Vector3 hitNormal, out int pointIndex ); virtual bool TryGetLinePoints(out Vector3[] points); virtual bool TryGetReticle(out GameObject reticle); };
Inherited Members¶
public: // methods bool TryGetLinePoints(out Vector3[] points); bool TryGetHitPoint( out Vector3 hitPosition, out Vector3 hitNormal, out int pointIndex ); bool TryGetReticle(out GameObject reticle);
Detailed Documentation¶
A simple interactor for UI elements.
Properties¶
Input InputSource
Gets or sets the input source for selecting UI elements.
GameObject Reticle
Gets the reticle to be used when hovering over UI Elements. Will be initialized on Start.
bool ShowLineVisualOnlyWhenPointingUI
Gets or sets a value indicating whether the line should be visible only when hovering over UI elements.
In order for visuals to work a LineVisualizer component must be attached to this GameObject or its children.
bool IsPointerOverUI
Gets a value indicating whether the pointer is over a UI element.
Methods¶
void BeginSelection()
Begin Selection Input for UIInteractor.
void EndSelection()
End Selection Input for UIInteractor.
virtual bool TryGetHitPoint( out Vector3 hitPosition, out Vector3 hitNormal, out int pointIndex )
Gets the hit point of the line.
Parameters:
hitPosition |
The position the line hits the object. |
hitNormal |
The normal at the hit position. |
pointIndex |
The point index in the line points at which the hit occurs. |
Returns:
true
if the line hits an object and the object can be interacted.
virtual bool TryGetLinePoints(out Vector3[] points)
Returns a list of the points that make up the line.
Parameters:
points |
An array of all the points defining the line. |
Returns:
true
if able to get at least 2 points (that make a line).
virtual bool TryGetReticle(out GameObject reticle)
Gets the reticle for the line end.
Parameters:
reticle |
The reticle gameobject. Forward will be aligned with the normal of the hit point. |
Returns:
true
if the reticle exists.