This site has been permanently archived. The content on this site was last updated in 2019.
Stay organized with collections
Save and categorize content based on your preferences.
GvrControllerReticleVisual
Visualizes a reticle using a Quad.
Summary
Provides tuning options to control how the reticle scales and rotates based on distance from the camera.
Inheritance
Inherits from: MonoBehaviour
Public attributes
|
doesReticleFaceCamera = new FaceCameraData(true)
|
Determines if the reticle will always face the camera and along which axes.
|
isSizeBasedOnCameraDistance = true
|
bool
If true , the scale is based on Camera Distance.
|
sizeMeters = 0.1f
|
float
The reticle will be scaled based on the size of the mesh so that its size matches this size.
|
sortingOrder = 0
|
int
Sorting order to use for the reticle's renderer.
|
Protected attributes
|
meshFilter
|
MeshFilter
The mesh filter for the reticle.
|
meshRenderer
|
MeshRenderer
The mesh renderer for the reticle.
|
Public functions
|
RefreshMesh()
|
void
Updates the mesh dimensions.
|
Protected functions
|
UpdateReticleOrientation(Camera camera)
|
virtual void
Updates the reticle position and orientation based on the camera.
|
UpdateReticleSize(Camera camera)
|
virtual void
Update the recticle size based on the distance.
|
Public attributes
doesReticleFaceCamera
FaceCameraData doesReticleFaceCamera = new FaceCameraData(true)
Determines if the reticle will always face the camera and along which axes.
isSizeBasedOnCameraDistance
bool isSizeBasedOnCameraDistance = true
If true
, the scale is based on Camera Distance.
If false
, the scale is set to the sizeMeters
value.
sizeMeters
float sizeMeters = 0.1f
The reticle will be scaled based on the size of the mesh so that its size matches this size.
Final size of the reticle in meters when it is 1 meter from the camera.
sortingOrder
int sortingOrder = 0
Protected attributes
meshFilter
MeshFilter meshFilter
The mesh filter for the reticle.
meshRenderer
MeshRenderer meshRenderer
The mesh renderer for the reticle.
Properties
ReticleMeshSizeMeters
float ReticleMeshSizeMeters
Gets the size of the reticle's mesh in meters.
The reticle mesh size in meters.
ReticleMeshSizeRatio
float ReticleMeshSizeRatio
Gets the ratio of the reticleMeshSizeMeters compared to 1 meter.
If reticleMeshSizeMeters is 10, then reticleMeshSizeRatio is 0.1.
The reticle mesh size ratio.
Public functions
RefreshMesh
void RefreshMesh()
Updates the mesh dimensions.
Protected functions
UpdateReticleOrientation
virtual void UpdateReticleOrientation(
Camera camera
)
Updates the reticle position and orientation based on the camera.
Locks orientation angles according to along*Axis
fields.
Details |
Parameters |
camera
|
The camera to update orientation to match.
|
|
UpdateReticleSize
virtual void UpdateReticleSize(
Camera camera
)
Update the recticle size based on the distance.
Details |
Parameters |
camera
|
The camera to update size relative to.
|
|
All rights reserved. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-09 UTC."],[[["\u003cp\u003eGvrControllerReticleVisual uses a Quad to display a reticle in VR, offering customizable scaling and rotation based on distance.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can control reticle size, facing direction, and rendering order through public attributes like \u003ccode\u003esizeMeters\u003c/code\u003e, \u003ccode\u003edoesReticleFaceCamera\u003c/code\u003e, and \u003ccode\u003esortingOrder\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe reticle's visual behavior is automatically updated based on the camera's position, ensuring proper alignment and scaling in the VR environment.\u003c/p\u003e\n"],["\u003cp\u003eKey functionalities include \u003ccode\u003eRefreshMesh\u003c/code\u003e for manual mesh updates, and protected methods like \u003ccode\u003eUpdateReticleOrientation\u003c/code\u003e and \u003ccode\u003eUpdateReticleSize\u003c/code\u003e for dynamic adjustments.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers have access to properties like \u003ccode\u003eReticleMeshSizeMeters\u003c/code\u003e and \u003ccode\u003eReticleMeshSizeRatio\u003c/code\u003e to query the reticle's current dimensions and proportions.\u003c/p\u003e\n"]]],["The `GvrControllerReticleVisual` visualizes a reticle using a Quad, scaling and rotating it based on camera distance. Key actions include setting whether the reticle faces the camera, controlling its size relative to camera distance with a `sizeMeters` attribute, and defining a `sortingOrder`. It updates the reticle's position and orientation via `UpdateReticleOrientation` and its size with `UpdateReticleSize`. The `RefreshMesh` function updates the reticle's mesh dimensions. `ReticleMeshSizeMeters` and `ReticleMeshSizeRatio` are key properties.\n"],null,["GvrControllerReticleVisual\n\nVisualizes a reticle using a Quad.\n\nSummary\n\nProvides tuning options to control how the reticle scales and rotates based on distance from the camera.\n\nInheritanceInherits from: MonoBehaviour\n\n| Public attributes ||\n|---------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [doesReticleFaceCamera](#classGvrControllerReticleVisual_1a33d9948a554b85067ba6744fe9e2a881)` = new FaceCameraData(true)` | [FaceCameraData](/vr/reference/unity/struct/GvrControllerReticleVisual/FaceCameraData#structGvrControllerReticleVisual_1_1FaceCameraData) Determines if the reticle will always face the camera and along which axes. |\n| [isSizeBasedOnCameraDistance](#classGvrControllerReticleVisual_1a06ae567a078ba15b753be6628ef8f723)` = true` | `bool` If `true`, the scale is based on Camera Distance. |\n| [sizeMeters](#classGvrControllerReticleVisual_1aed4b4a99bc55ed4c9c7b9136340b2b81)` = 0.1f` | `float` The reticle will be scaled based on the size of the mesh so that its size matches this size. |\n| [sortingOrder](#classGvrControllerReticleVisual_1ac0262cd53e12134536c89f97297f985b)` = 0` | `int` Sorting order to use for the reticle's renderer. |\n\n| Protected attributes ||\n|-------------------------------------------------------------------------------------|---------------------------------------------------|\n| [meshFilter](#classGvrControllerReticleVisual_1aef24255a276551bef199b1e5aaa76332) | `MeshFilter` The mesh filter for the reticle. |\n| [meshRenderer](#classGvrControllerReticleVisual_1a767798a6bc3489eb0487dd44d85e3d52) | `MeshRenderer` The mesh renderer for the reticle. |\n\n| Properties ||\n|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|\n| [ReticleMeshSizeMeters](#classGvrControllerReticleVisual_1a2f7da944a08f8d3f583abb2411d7f549) | `float` Gets the size of the reticle's mesh in meters. |\n| [ReticleMeshSizeRatio](#classGvrControllerReticleVisual_1abb0f2c5c23975b0a784fb0e58cc52025) | `float` Gets the ratio of the reticleMeshSizeMeters compared to 1 meter. |\n\n| Public functions ||\n|----------------------------------------------------------------------------------------|-------------------------------------|\n| [RefreshMesh](#classGvrControllerReticleVisual_1abea9df9c34ede8af5022cad963a40e63)`()` | `void` Updates the mesh dimensions. |\n\n| Protected functions ||\n|------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|\n| [UpdateReticleOrientation](#classGvrControllerReticleVisual_1a8fa6e7dc69a6749660b6414af521a73a)`(Camera camera)` | `virtual void` Updates the reticle position and orientation based on the camera. |\n| [UpdateReticleSize](#classGvrControllerReticleVisual_1a3e8094e878deebfdf06db5ca30f7818f)`(Camera camera)` | `virtual void` Update the recticle size based on the distance. |\n\n| Structs ||\n|-------------------------------------------------------------------------------------------------------------------|---------------------------------|\n| [GvrControllerReticleVisual.FaceCameraData](/vr/reference/unity/struct/GvrControllerReticleVisual/FaceCameraData) | Camera facing positioning data. |\n\nPublic attributes \n\ndoesReticleFaceCamera \n\n```c#\nFaceCameraData doesReticleFaceCamera = new FaceCameraData(true)\n``` \nDetermines if the reticle will always face the camera and along which axes. \n\nisSizeBasedOnCameraDistance \n\n```c#\nbool isSizeBasedOnCameraDistance = true\n``` \nIf `true`, the scale is based on Camera Distance.\n\nIf `false`, the scale is set to the `sizeMeters` value. \n\nsizeMeters \n\n```c#\nfloat sizeMeters = 0.1f\n``` \nThe reticle will be scaled based on the size of the mesh so that its size matches this size.\n\nFinal size of the reticle in meters when it is 1 meter from the camera. \n\nsortingOrder \n\n```c#\nint sortingOrder = 0\n``` \nSorting order to use for the reticle's renderer.\n\nRange values come from \u003chttps://docs.unity3d.com/ScriptReference/Renderer-sortingOrder.html\u003e.\n\nProtected attributes \n\nmeshFilter \n\n```c#\nMeshFilter meshFilter\n``` \nThe mesh filter for the reticle. \n\nmeshRenderer \n\n```c#\nMeshRenderer meshRenderer\n``` \nThe mesh renderer for the reticle.\n\nProperties \n\nReticleMeshSizeMeters \n\n```c#\nfloat ReticleMeshSizeMeters\n``` \nGets the size of the reticle's mesh in meters.\n\nThe reticle mesh size in meters. \n\nReticleMeshSizeRatio \n\n```c#\nfloat ReticleMeshSizeRatio\n``` \nGets the ratio of the reticleMeshSizeMeters compared to 1 meter.\n\nIf reticleMeshSizeMeters is 10, then reticleMeshSizeRatio is 0.1.\n\nThe reticle mesh size ratio.\n\nPublic functions \n\nRefreshMesh \n\n```c#\nvoid RefreshMesh()\n``` \nUpdates the mesh dimensions.\n\nProtected functions \n\nUpdateReticleOrientation \n\n```c#\nvirtual void UpdateReticleOrientation(\n Camera camera\n)\n``` \nUpdates the reticle position and orientation based on the camera.\n\nLocks orientation angles according to `along*Axis` fields.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|---------------------------------------------------------------------------------------------------------------------|\n| Parameters | |----------|--------------------------------------------| | `camera` | The camera to update orientation to match. | |\n\nUpdateReticleSize \n\n```c#\nvirtual void UpdateReticleSize(\n Camera camera\n)\n``` \nUpdate the recticle size based on the distance.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|-------------------------------------------------------------------------------------------------------------|\n| Parameters | |----------|----------------------------------------| | `camera` | The camera to update size relative to. | |"]]