Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- if( collision.gameObject.tag == "Player" )
- {
- ContactPoint contact = collision.contacts[0];
- Quaternion rot = Quaternion.FromToRotation(Vector3.up, contact.normal);
- Vector3 pos = contact.point;
- Instantiate(Resources.Load("explosion"), pos, rot);
- Rigidbody gameObjectsRigidBody = collision.gameObject.AddComponent<Rigidbody>(); // Add the rigidbody.
- gameObjectsRigidBody.mass = 5; // Set the GO's mass to 5 via the Rigidbody.
- //Destroy(collision.gameObject);
- Destroy(gameObject);
- }
- /*
- if( collision.gameObject.tag == "Player" )
- { Destroy(collision.gameObject);
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement