Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. {
  2.        
  3.         if( collision.gameObject.tag == "Player" )
  4.         {
  5.             ContactPoint contact = collision.contacts[0];
  6.             Quaternion rot = Quaternion.FromToRotation(Vector3.up, contact.normal);
  7.             Vector3 pos = contact.point;
  8.            
  9.             Instantiate(Resources.Load("explosion"), pos, rot);
  10.            
  11.             Rigidbody gameObjectsRigidBody = collision.gameObject.AddComponent<Rigidbody>(); // Add the rigidbody.
  12.             gameObjectsRigidBody.mass = 5; // Set the GO's mass to 5 via the Rigidbody.
  13.            
  14.             //Destroy(collision.gameObject);
  15.             Destroy(gameObject);
  16.         }
  17.         /*
  18.         if( collision.gameObject.tag == "Player" )
  19.         {    Destroy(collision.gameObject);
  20.         */
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement