Skip to content

Instantly share code, notes, and snippets.

@amonks
Created November 4, 2015 04:52
Show Gist options
  • Select an option

  • Save amonks/6b848c79be30eada7cee to your computer and use it in GitHub Desktop.

Select an option

Save amonks/6b848c79be30eada7cee to your computer and use it in GitHub Desktop.
// 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