void OnPhysicsCollisionExit(PhysicsCollider other) { if (other.CompareTag("Terrain")) { Debug.Log("Left planet"); physics.attractionActive = true; onPlanet = null; } }
void OnPhysicsCollisionEnter(PhysicsCollider other) { if (other.CompareTag("Terrain")) //hit planet { if (onPlanet == null) { Debug.Log("Hit planet"); physics.attractionActive = false; physics.Stop(); onPlanet = other.GetComponent <Planet>(); } else //squished between planets //TODO: kill player (probably a different script tho) { } } }