private void cache(PlanetariaShape shape) { PlanetariaCache.uncache(this); shape_variable = shape; if (shape != null) { PlanetariaCache.cache(this); PlanetariaSphereCollider sphere = shape.bounding_sphere; internal_collider.center = sphere.center; internal_collider.radius = sphere.radius; } else { internal_collider.radius = float.NegativeInfinity; // FIXME: HACK: ensure there are no collisions } internal_collider.isTrigger = true; // Rigidbody must be added for collisions to be detected. }
protected override void OnDestroy() { PlanetariaCache.uncache(this); GameObject.Destroy(internal_collider); }