public void Die() { visuals.SetActive(false); GetComponent <Collider>().enabled = false; GetComponent <PlanetGravity>().enabled = false; foreach (GameObject o in disabledOnDeath) { o.SetActive(false); } broken.SetActive(true); Rigidbody[] bodies = broken.GetComponentsInChildren <Rigidbody>(); foreach (Rigidbody b in bodies) { b.velocity = body.velocity; b.angularVelocity = body.angularVelocity; b.velocity += Vector3.Normalize(b.transform.position - transform.position) * 3; } body.velocity = Vector3.zero; body.angularVelocity = Vector3.zero; active = false; dead = true; GameMgr.AddDeath(); }