GvrReticlePointer

Draws a circular reticle in front of any object that the user points at.

Summary

The circle dilates if the object is clickable.

Inheritance

Inherits from: GvrBasePointer

Public attributes

RETICLE_DISTANCE_MIN = 0.45f
const float
Minimum distance of the reticle (in meters).
RETICLE_GROWTH_ANGLE = 1.5f
const float
Angle at which to expand the reticle when intersecting with an object (in degrees).
RETICLE_MIN_INNER_ANGLE = 0.0f
const float
The constants below are expsed for testing. Minimum inner angle of the reticle (in degrees).
RETICLE_MIN_OUTER_ANGLE = 0.5f
const float
Minimum outer angle of the reticle (in degrees).
maxReticleDistance = 20.0f
float
Maximum distance of the reticle (in meters).
reticleGrowthSpeed = 8.0f
float
Growth speed multiplier for the reticle/.
reticleSegments = 20
int
Number of segments making the reticle circle.
reticleSortingOrder = 32767
int
Sorting order to use for the reticle's renderer.

Properties

MaterialComp
Material
MaxPointerDistance
override float
ReticleDistanceInMeters
float
ReticleInnerAngle
float
ReticleInnerDiameter
float
ReticleOuterAngle
float
ReticleOuterDiameter
float

Public functions

GetPointerRadius(out float enterRadius, out float exitRadius)
virtual override void
Return the radius of the pointer.
OnPointerClickDown()
virtual override void
Called when a click is initiated.
OnPointerClickUp()
virtual override void
Called when click is finished.
OnPointerEnter(RaycastResult raycastResult, bool isInteractive)
virtual override void
Called when the pointer is facing a valid GameObject.
OnPointerExit(GameObject previousObject)
virtual override void
Called when the pointer no longer faces an object previously intersected with a ray projected from the camera.
OnPointerHover(RaycastResult raycastResultResult, bool isInteractive)
virtual override void
Called every frame the user is still pointing at a valid GameObject.
UpdateDiameters()
void

Protected functions

Start()
virtual override void

Public attributes

RETICLE_DISTANCE_MIN

const float RETICLE_DISTANCE_MIN = 0.45f

Minimum distance of the reticle (in meters).

RETICLE_GROWTH_ANGLE

const float RETICLE_GROWTH_ANGLE = 1.5f

Angle at which to expand the reticle when intersecting with an object (in degrees).

RETICLE_MIN_INNER_ANGLE

const float RETICLE_MIN_INNER_ANGLE = 0.0f

The constants below are expsed for testing. Minimum inner angle of the reticle (in degrees).

RETICLE_MIN_OUTER_ANGLE

const float RETICLE_MIN_OUTER_ANGLE = 0.5f

Minimum outer angle of the reticle (in degrees).

maxReticleDistance

float maxReticleDistance = 20.0f

Maximum distance of the reticle (in meters).

reticleGrowthSpeed

float reticleGrowthSpeed = 8.0f

Growth speed multiplier for the reticle/.

reticleSegments

int reticleSegments = 20

Number of segments making the reticle circle.

reticleSortingOrder

int reticleSortingOrder = 32767

Sorting order to use for the reticle's renderer.

Range values come from https://docs.unity3d.com/ScriptReference/Renderer-sortingOrder.html. Default value 32767 ensures gaze reticle is always rendered on top.

Properties

MaterialComp

Material MaterialComp

MaxPointerDistance

override float MaxPointerDistance

ReticleDistanceInMeters

float ReticleDistanceInMeters

ReticleInnerAngle

float ReticleInnerAngle

ReticleInnerDiameter

float ReticleInnerDiameter

ReticleOuterAngle

float ReticleOuterAngle

ReticleOuterDiameter

float ReticleOuterDiameter

Public functions

GetPointerRadius

virtual override void GetPointerRadius(
  out float enterRadius,
  out float exitRadius
)

Return the radius of the pointer.

It is used by GvrPointerPhysicsRaycaster when searching for valid pointer targets. If a radius is 0, then a ray is used to find a valid pointer target. Otherwise it will use a SphereCast. The enterRadius is used for finding new targets while the exitRadius is used to see if you are still nearby the object currently pointed at to avoid a flickering effect when just at the border of the intersection.

NOTE: This is only works with GvrPointerPhysicsRaycaster. To use it with uGUI, add 3D colliders to your canvas elements.

OnPointerClickDown

virtual override void OnPointerClickDown()

Called when a click is initiated.

OnPointerClickUp

virtual override void OnPointerClickUp()

Called when click is finished.

OnPointerEnter

virtual override void OnPointerEnter(
  RaycastResult raycastResult,
  bool isInteractive
)

Called when the pointer is facing a valid GameObject.

This can be a 3D or UI element.

raycastResult is the hit detection result for the object being pointed at. isInteractive is true if the object being pointed at is interactive.

OnPointerExit

virtual override void OnPointerExit(
  GameObject previousObject
)

Called when the pointer no longer faces an object previously intersected with a ray projected from the camera.

This is also called just before OnInputModuleDisabled previousObject will be null in this case.

previousObject is the object that was being pointed at the previous frame.

OnPointerHover

virtual override void OnPointerHover(
  RaycastResult raycastResultResult,
  bool isInteractive
)

Called every frame the user is still pointing at a valid GameObject.

This can be a 3D or UI element.

raycastResult is the hit detection result for the object being pointed at. isInteractive is true if the object being pointed at is interactive.

UpdateDiameters

void UpdateDiameters()

Protected functions

Start

virtual override void Start()