/// <summary> /// Return the status of two boxes intersect /// </summary> public bool BoxesIntersect(MyBoxBound otherBound) { return (XInterval.IntervalsIntersect(otherBound.XInterval) // x intervals intersect && // and YInterval.IntervalsIntersect(otherBound.YInterval) // y intervals intersect && // and ZInterval.IntervalsIntersect(otherBound.ZInterval)); // z intervals intersect }
public GameObject TestPosition = null; // position for performing inside/outside test // Start is called before the first frame update void Start() { Debug.Assert(CenterPos != null); // Ensure proper setup in the Hierarchy Window Debug.Assert(MinPos != null); Debug.Assert(MaxPos != null); Debug.Assert(TestPosition != null); MyBound = new MyBoxBound(); // Instantiate for visualization }
public Vector3 OverlapBoxMax = Vector3.zero; // Max position of the overlapping bounding box // Start is called before the first frame update void Start() { Debug.Assert(TheTaxi != null); // Ensure that proper reference setup in Inspector Window Debug.Assert(TheCar != null); TaxiBound = new MyBoxBound(); // Instantiate the visualization variables CarBound = new MyBoxBound(); OverlapBox = new MyBoxBound(); OverlapBox.SetBoxColor(new Color(0.4f, 0.9f, 0.9f, 0.6f)); OverlapBox.DrawBoundingBox = false; // hide the overlap box initially OverlapBox.DrawIntervals = false; // not showing this in this example }