Skip to content

Commit bf04047

Browse files
author
Julia Schwarz
committed
remove usages of cone
1 parent b7a5653 commit bf04047

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

Assets/MixedRealityToolkit/Utilities/CameraFOVChecker.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,21 @@
55
using System;
66
using System.Collections.Generic;
77
using UnityEngine;
8+
using UnityEngine.Profiling;
89

910
namespace Microsoft.MixedReality.Toolkit
1011
{
1112
/// <summary>
12-
/// Camera extension methods to test if colliders are within an FOV cone. Uses
13+
/// Camera extension methods to test if colliders are within camera's FOV. Uses
1314
/// caching to improve performance and ensure values are only computed once per frame
1415
/// </summary>
1516
public static class CameraFOVChecker
1617
{
1718

1819
// Help to clear caches when new frame runs
19-
static private int inFOVConeLastCalculatedFrame = -1;
20+
static private int inFOVLastCalculatedFrame = -1;
2021
// Map from grabbable => is the grabbable in FOV for this frame. Cleared every frame
21-
private static Dictionary<Tuple<Collider, Camera>, bool> inFOVConeColliderCache = new Dictionary<Tuple<Collider, Camera>, bool>();
22+
private static Dictionary<Tuple<Collider, Camera>, bool> inFOVColliderCache = new Dictionary<Tuple<Collider, Camera>, bool>();
2223
// List of corners shared across all sphere pointer query instances --
2324
// used to store list of corners for a bounds. Shared and static
2425
// to avoid allocating memory each frame
@@ -41,12 +42,12 @@ public static bool IsInFOVCached(this Camera cam, Collider myCollider)
4142

4243
Tuple<Collider, Camera> cameraColliderPair = new Tuple<Collider, Camera>(myCollider, cam);
4344
bool result = false;
44-
if (inFOVConeLastCalculatedFrame != Time.frameCount)
45+
if (inFOVLastCalculatedFrame != Time.frameCount)
4546
{
46-
inFOVConeColliderCache.Clear();
47-
inFOVConeLastCalculatedFrame = Time.frameCount;
47+
inFOVColliderCache.Clear();
48+
inFOVLastCalculatedFrame = Time.frameCount;
4849
}
49-
else if (inFOVConeColliderCache.TryGetValue(cameraColliderPair, out result))
50+
else if (inFOVColliderCache.TryGetValue(cameraColliderPair, out result))
5051
{
5152
return result;
5253
}
@@ -68,7 +69,7 @@ public static bool IsInFOVCached(this Camera cam, Collider myCollider)
6869

6970
if (isInFOV)
7071
{
71-
inFOVConeColliderCache.Add(cameraColliderPair, true);
72+
inFOVColliderCache.Add(cameraColliderPair, true);
7273
return true;
7374
}
7475

@@ -94,7 +95,7 @@ public static bool IsInFOVCached(this Camera cam, Collider myCollider)
9495
&& yMin < 1 // Bottom edge is not too high.
9596
&& yMax > 0; // Top edge is not too low.
9697

97-
inFOVConeColliderCache.Add(cameraColliderPair, result);
98+
inFOVColliderCache.Add(cameraColliderPair, result);
9899

99100
return result;
100101
}

0 commit comments

Comments
 (0)