Skip to content

Instantly share code, notes, and snippets.

@mhomol
Created January 4, 2016 21:01
Show Gist options
  • Save mhomol/2920928e1e649073e4c1 to your computer and use it in GitHub Desktop.
Save mhomol/2920928e1e649073e4c1 to your computer and use it in GitHub Desktop.
Bag Labs Post - 3D Runner - Handling Collisions
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