Created
November 4, 2015 04:52
-
-
Save amonks/6b848c79be30eada7cee to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Create a floor tile, and put this script on it. | |
| // Make sure that floor tile has a collider and a rigidbody. | |
| // Make sure that rigidbody has `Use Gravity` but not `Is Kinematic` checked | |
| // Also make sure it has all of the constraints checked | |
| using UnityEngine; | |
| using System.Collections; | |
| public class dropTile : MonoBehaviour { | |
| public bool shouldDrop; | |
| void OnCollisionExit (Collision c) { | |
| Debug.Log("EXIT COLLISION", gameObject); | |
| if (shouldDrop == true) { | |
| gameObject.GetComponent<Rigidbody> ().constraints = RigidbodyConstraints.None; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment