# GvrPointerPhysicsRaycaster Class Reference

# GvrPointerPhysicsRaycaster

This script provides a raycaster for use with the `https://developers.google.com/vr/reference/unity/class/GvrPointerInputModule#classGvrPointerInputModule`.

## 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](https://developers.google.com/vr/reference/unity/class/GvrBasePointerRaycaster)

| ### Protected attributes ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrPointerPhysicsRaycaster#classGvrPointerPhysicsRaycaster_1a5dd66f381488a5c2e824a2e672d6c0ce = -1` | `const int` Const to use for clarity when no event mask is set. |
| `https://developers.google.com/vr/reference/unity/class/GvrPointerPhysicsRaycaster#classGvrPointerPhysicsRaycaster_1a633de319d28c793aa687a2dfde0095f2 = NO_EVENT_MASK_SET` | `LayerMask` Layer mask used to filter events. |

| ### Properties ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrPointerPhysicsRaycaster#classGvrPointerPhysicsRaycaster_1af8188337ebc6ea7a4cd4964c4c8248cc` | `int` Gets or sets the maximum number of hits that the raycaster can detect at once. |
| `https://developers.google.com/vr/reference/unity/class/GvrPointerPhysicsRaycaster#classGvrPointerPhysicsRaycaster_1a3a92b7eb4b629c987d0aff49066b4c23` | `override Camera` |
| `https://developers.google.com/vr/reference/unity/class/GvrPointerPhysicsRaycaster#classGvrPointerPhysicsRaycaster_1aab285ed74141296786fc56f8d6169368` | `LayerMask` Gets or sets the layer mask used to filter events. |
| `https://developers.google.com/vr/reference/unity/class/GvrPointerPhysicsRaycaster#classGvrPointerPhysicsRaycaster_1ac3e21113dc5b300fe83db81a30ce6787` | `int` Gets the event mask used to determine which objects will receive events. |

| ### Protected functions ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrPointerPhysicsRaycaster#classGvrPointerPhysicsRaycaster_1abe29c4de89cfdb73534d22c924ba27d6()` | ` `` Initializes a new instance of the https://developers.google.com/vr/reference/unity/class/GvrPointerPhysicsRaycaster#classGvrPointerPhysicsRaycaster class. ` |
| `https://developers.google.com/vr/reference/unity/class/GvrPointerPhysicsRaycaster#classGvrPointerPhysicsRaycaster_1a8ef54ea72e6d62d91b63bf4b0b558c7b(https://developers.google.com/vr/reference/unity/struct/GvrBasePointer/PointerRay#structGvrBasePointer_1_1PointerRay pointerRay, float radius, PointerEventData eventData, List< RaycastResult > resultAppendList)` | `virtual override bool` Perform raycast on the scene. |

## Protected attributes

### NO_EVENT_MASK_SET

```c#
const int NO_EVENT_MASK_SET = -1
```
Const to use for clarity when no event mask is set.

### raycasterEventMask

```c#
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

```c#
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

```c#
override Camera eventCamera
```

### eventMask

```c#
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

```c#
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

```c#
 GvrPointerPhysicsRaycaster()
```
Initializes a new instance of the [GvrPointerPhysicsRaycaster](https://developers.google.com/vr/reference/unity/class/GvrPointerPhysicsRaycaster#classGvrPointerPhysicsRaycaster) class.

### PerformRaycast

```c#
virtual override bool PerformRaycast(
  GvrBasePointer.PointerRay pointerRay,
  float radius,
  PointerEventData eventData,
  List< RaycastResult > resultAppendList
)
```
Perform raycast on the scene.