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.
GvrPointerPhysicsRaycaster
This script provides a raycaster for use with the GvrPointerInputModule
.
Summary
It behaves similarly to the standards Physics raycaster, except that it utilize raycast modes specifically for Gvr.
View GvrBasePointerRaycaster.cs
and GvrPointerInputModule.cs
for more details.
Inheritance
Inherits from:
GvrBasePointerRaycaster
Protected attributes
|
NO_EVENT_MASK_SET = -1
|
const int
Const to use for clarity when no event mask is set.
|
raycasterEventMask = NO_EVENT_MASK_SET
|
LayerMask
Layer mask used to filter events.
|
Properties
|
MaxRaycastHits
|
int
Gets or sets the maximum number of hits that the raycaster can detect at once.
|
eventCamera
|
override Camera
|
eventMask
|
LayerMask
Gets or sets the layer mask used to filter events.
|
finalEventMask
|
int
Gets the event mask used to determine which objects will receive events.
|
Protected attributes
NO_EVENT_MASK_SET
const int NO_EVENT_MASK_SET = -1
Const to use for clarity when no event mask is set.
raycasterEventMask
LayerMask raycasterEventMask = NO_EVENT_MASK_SET
Layer mask used to filter events.
Always combined with the camera's culling mask if a camera is used.
Properties
MaxRaycastHits
int MaxRaycastHits
Gets or sets the maximum number of hits that the raycaster can detect at once.
They are NOT guaranteed to be ordered by distance. This value should be set to a higher number than the number of objects the pointer is expected to intersect with in a single frame.
This functionality is used to prevent unnecessary memory allocation to improve performance. https://docs.unity3d.com/ScriptReference/Physics.SphereCastNonAlloc.html.
The maximum number of hits that the raycaster can detect at once.
eventCamera
override Camera eventCamera
eventMask
LayerMask eventMask
Gets or sets the layer mask used to filter events.
Always combined with the camera's culling mask if a camera is used.
The layer mask used to filter events.
finalEventMask
int finalEventMask
Gets the event mask used to determine which objects will receive events.
The event mask used to determine which objects will receive events.
Protected functions
GvrPointerPhysicsRaycaster
GvrPointerPhysicsRaycaster()
virtual override bool PerformRaycast(
GvrBasePointer.PointerRay pointerRay,
float radius,
PointerEventData eventData,
List< RaycastResult > resultAppendList
)
Perform raycast on the scene.
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\u003e\u003ccode\u003eGvrPointerPhysicsRaycaster\u003c/code\u003e provides a raycaster for use with \u003ccode\u003eGvrPointerInputModule\u003c/code\u003e, enabling gaze-based interactions in VR.\u003c/p\u003e\n"],["\u003cp\u003eIt functions similarly to the standard Physics Raycaster but uses raycast modes tailored for Google VR.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMaxRaycastHits\u003c/code\u003e property sets the maximum number of detectable hits, influencing performance by limiting memory allocation.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can utilize \u003ccode\u003eeventMask\u003c/code\u003e to filter the objects that receive events based on their layer.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ePerformRaycast\u003c/code\u003e is the core function for executing the raycast, identifying interactive elements in the VR scene.\u003c/p\u003e\n"]]],["The `GvrPointerPhysicsRaycaster` script, used with `GvrPointerInputModule`, performs raycasts tailored for Gvr. It utilizes protected attributes like `NO_EVENT_MASK_SET` and `raycasterEventMask` to filter events. Key properties include `MaxRaycastHits`, controlling the maximum detectable hits, and `eventMask`, setting the layer mask for events. `PerformRaycast` function, does the raycast. `eventCamera` can also be used. It can be initialized using `GvrPointerPhysicsRaycaster()`.\n"],null,["# GvrPointerPhysicsRaycaster Class Reference\n\nGvrPointerPhysicsRaycaster\n==========================\n\nThis script provides a raycaster for use with the [GvrPointerInputModule](/vr/reference/unity/class/GvrPointerInputModule#classGvrPointerInputModule).\n\nSummary\n-------\n\nIt behaves similarly to the standards Physics raycaster, except that it utilize raycast modes specifically for Gvr.\n\nView `GvrBasePointerRaycaster.cs` and `GvrPointerInputModule.cs` for more details.\n\n### Inheritance\n\nInherits from: [GvrBasePointerRaycaster](/vr/reference/unity/class/GvrBasePointerRaycaster)\n\n| ### Protected attributes ||\n|-----------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|\n| [NO_EVENT_MASK_SET](#classGvrPointerPhysicsRaycaster_1a5dd66f381488a5c2e824a2e672d6c0ce)` = -1` | `const int` Const to use for clarity when no event mask is set. |\n| [raycasterEventMask](#classGvrPointerPhysicsRaycaster_1a633de319d28c793aa687a2dfde0095f2)` = NO_EVENT_MASK_SET` | `LayerMask` Layer mask used to filter events. |\n\n| ### Properties ||\n|---------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|\n| [MaxRaycastHits](#classGvrPointerPhysicsRaycaster_1af8188337ebc6ea7a4cd4964c4c8248cc) | `int` Gets or sets the maximum number of hits that the raycaster can detect at once. |\n| [eventCamera](#classGvrPointerPhysicsRaycaster_1a3a92b7eb4b629c987d0aff49066b4c23) | `override Camera` |\n| [eventMask](#classGvrPointerPhysicsRaycaster_1aab285ed74141296786fc56f8d6169368) | `LayerMask` Gets or sets the layer mask used to filter events. |\n| [finalEventMask](#classGvrPointerPhysicsRaycaster_1ac3e21113dc5b300fe83db81a30ce6787) | `int` Gets the event mask used to determine which objects will receive events. |\n\n| ### Protected functions ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [GvrPointerPhysicsRaycaster](#classGvrPointerPhysicsRaycaster_1abe29c4de89cfdb73534d22c924ba27d6)`()` | ` ` ` `Initializes a new instance of the [GvrPointerPhysicsRaycaster](/vr/reference/unity/class/GvrPointerPhysicsRaycaster#classGvrPointerPhysicsRaycaster) class. ` ` |\n| [PerformRaycast](#classGvrPointerPhysicsRaycaster_1a8ef54ea72e6d62d91b63bf4b0b558c7b)`(`[GvrBasePointer.PointerRay](/vr/reference/unity/struct/GvrBasePointer/PointerRay#structGvrBasePointer_1_1PointerRay)` pointerRay, float radius, PointerEventData eventData, List\u003c RaycastResult \u003e resultAppendList)` | `virtual override bool` Perform raycast on the scene. |\n\nProtected attributes\n--------------------\n\n### NO_EVENT_MASK_SET\n\n```c#\nconst int NO_EVENT_MASK_SET = -1\n``` \nConst to use for clarity when no event mask is set. \n\n### raycasterEventMask\n\n```c#\nLayerMask raycasterEventMask = NO_EVENT_MASK_SET\n``` \nLayer mask used to filter events.\n\nAlways combined with the camera's culling mask if a camera is used.\n\nProperties\n----------\n\n### MaxRaycastHits\n\n```c#\nint MaxRaycastHits\n``` \nGets or sets the maximum number of hits that the raycaster can detect at once.\n\nThey are NOT guaranteed to be ordered by distance. This value should be set to a higher number than the number of objects the pointer is expected to intersect with in a single frame.\n\nThis functionality is used to prevent unnecessary memory allocation to improve performance. \u003chttps://docs.unity3d.com/ScriptReference/Physics.SphereCastNonAlloc.html\u003e.\n\nThe maximum number of hits that the raycaster can detect at once. \n\n### eventCamera\n\n```c#\noverride Camera eventCamera\n``` \n\n### eventMask\n\n```c#\nLayerMask eventMask\n``` \nGets or sets the layer mask used to filter events.\n\nAlways combined with the camera's culling mask if a camera is used.\n\nThe layer mask used to filter events. \n\n### finalEventMask\n\n```c#\nint finalEventMask\n``` \nGets the event mask used to determine which objects will receive events.\n\nThe event mask used to determine which objects will receive events.\n\nProtected functions\n-------------------\n\n### GvrPointerPhysicsRaycaster\n\n```c#\n GvrPointerPhysicsRaycaster()\n``` \nInitializes a new instance of the [GvrPointerPhysicsRaycaster](/vr/reference/unity/class/GvrPointerPhysicsRaycaster#classGvrPointerPhysicsRaycaster) class. \n\n### PerformRaycast\n\n```c#\nvirtual override bool PerformRaycast(\n GvrBasePointer.PointerRay pointerRay,\n float radius,\n PointerEventData eventData,\n List\u003c RaycastResult \u003e resultAppendList\n)\n``` \nPerform raycast on the scene."]]