public float DistanceBetween = 0.0f; // Distance between the car and APoint // Start is called before the first frame update void Start() { Debug.Assert(APoint != null); // Make sure proper editor setup Debug.Assert(TheCar != null); SphereBound = new MySphereBound(); // To visualize the sphere bound }
// Start is called before the first frame update void Start() { Debug.Assert(TheTaxi != null); // Make sure proper editor setup Debug.Assert(TheCar != null); TaxiBound = new MySphereBound(); CarBound = new MySphereBound(); }
// Returns if there is an intersection with anotherSphere public bool SpheresIntersects(MySphereBound anotherSphere) { Vector3 diff = this.Center - anotherSphere.Center; return(diff.magnitude <= (this.Radius + anotherSphere.Radius)); }