File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
Assets/MixedRealityToolkit/Utilities Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,14 @@ public static bool IsInFOVConeCached(this Camera cam,
3737 return false ;
3838 }
3939
40+ var cameraColliderPair = ( collider : myCollider , camera : cam ) ;
41+ bool result = false ;
4042 if ( inFOVConeLastCalculatedFrame != Time . frameCount )
4143 {
4244 inFOVConeColliderCache . Clear ( ) ;
4345 inFOVConeLastCalculatedFrame = Time . frameCount ;
44- }
45- var cameraColliderPair = ( collider : myCollider , camera : cam ) ;
46- if ( inFOVConeColliderCache . TryGetValue ( cameraColliderPair , out bool result ) )
46+ } else if ( inFOVConeColliderCache . TryGetValue ( cameraColliderPair , out result ) )
4747 {
48- Debug . Log ( $ "Cache hit! Returning { result } ") ;
4948 return result ;
5049 }
5150
@@ -71,8 +70,6 @@ public static bool IsInFOVConeCached(this Camera cam,
7170 zMax = Mathf . Max ( zMax , corner . z ) ;
7271 }
7372
74- // edge case: check if camera is inside the entire bounds of the collider;
75- // Consider simplifying to myCollider.bounds.Contains(CameraCache.main.transform.position)
7673 var cameraPos = cam . transform . position ;
7774 result = xMin <= cameraPos . x && cameraPos . x <= xMax
7875 && yMin <= cameraPos . y && cameraPos . y <= yMax
You can’t perform that action at this time.
0 commit comments