Advertisement
jyourman

Untitled

Aug 28th, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Respawn : MonoBehaviour {
  5. public GameObject Platform;
  6.  
  7. // Use this for initialization
  8. void Start () {
  9.  
  10. }
  11.  
  12. // Update is called once per frame
  13. void Update () {
  14. if(transform.position.y < -2f) {
  15. transform.position = new Vector3(0, 2, 0);
  16. transform.rotation = Quaternion.identity;
  17. Rigidbody playerRigid = gameObject.GetComponent<Rigidbody>();
  18. playerRigid.velocity = Vector3.zero;
  19. playerRigid.angularVelocity = Vector3.zero;
  20. Platform.transform.rotation = Quaternion.identity;
  21. Platform.GetComponent<Rigidbody>().angularVelocity = Vector3.zero;
  22.  
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement