Created
January 4, 2016 21:01
-
-
Save mhomol/2920928e1e649073e4c1 to your computer and use it in GitHub Desktop.
Bag Labs Post - 3D Runner - Handling Collisions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void OnCollisionEnter (Collision collision) | |
{ | |
Rigidbody body = collision.rigidbody; | |
if (body != null) | |
{ | |
if (body.tag == "Cube1") | |
{ | |
MovingObstacles movingObstacles = GameObject.FindObjectOfType(typeof(MovingObstacles)) as MovingObstacles; | |
movingObstacles.running = false; | |
SceneManager.LoadScene ("Game Over Scene"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment