9 public class Zones : MonoBehaviour
11 [Tooltip(
"The number of zones within the CAVERN angle. There is one extra zone where there is no screen.")]
14 [Tooltip(
"The radius in the middle of the CAVERN that acts as a deadzone, to avoid rapid angle changes.")]
17 [Tooltip(
"The CAVERN renderer, needed to get angle and radius information.")]
20 [Tooltip(
"Each object you want to track through zones should have an entry in this array.")]
26 [Tooltip(
"The object to track in zones. Usually a Vive Tracker.")]
28 [Tooltip(
"The current zone the object is in. -1 if out of bounds, or between 0 and numZones.")]
30 [Tooltip(
"The distance the object is from the edge of the deadzone. Ranges from [0,1], where 1 is the edge of the CAVERN.")]
40 tracker_pos.y =
cavern.transform.position.y;
42 float angle = Vector3.SignedAngle(tracker_pos - transform.position, Vector3.forward, Vector3.down);
50 float distance = Vector3.Distance(tracker_pos, transform.position);
67 Handles.DrawWireDisc(transform.position, Vector3.up,
innerDeadZone);
69 float angle = -cavernAngle / 2;
70 float deltaAngle = cavernAngle /
numZones;
71 for (
int i = 0; i <
numZones + 1; i++)
73 Vector3 angleLine =
new(Mathf.Sin(angle), 0, Mathf.Cos(angle));
ZonedTracker[] zonedTrackers