Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class spawnPoints : MonoBehaviour {
  6.  
  7. public Vector3 ObjectSpawnPosition;
  8. public GameObject ObjectSpawn1;
  9. public GameObject ObjectSpawn2;
  10. public GameObject ObjectSpawn3;
  11. public GameObject ObjectSpawn4;
  12.  
  13. public Rigidbody rigidbody;
  14.  
  15. void Start()
  16. {
  17. rigidbody = GetComponent<Rigidbody>();
  18. }
  19.  
  20. void FixedUpdate() {
  21. if (Input.GetKeyDown(KeyCode.Alpha7))
  22. {
  23. rigidbody.isKinematic = true;
  24. rigidbody.velocity = Vector3.zero;
  25. rigidbody.angularVelocity = Vector3.zero;
  26. transform.position = ObjectSpawn1.transform.position;
  27. transform.rotation = ObjectSpawn1.transform.rotation;
  28. rigidbody.isKinematic = false;
  29. }
  30.  
  31. if (Input.GetKeyDown(KeyCode.Alpha8))
  32. {
  33. rigidbody.isKinematic = true;
  34. rigidbody.velocity = Vector3.zero;
  35. rigidbody.angularVelocity = Vector3.zero;
  36. transform.position = ObjectSpawn1.transform.position;
  37. transform.rotation = ObjectSpawn1.transform.rotation;
  38. rigidbody.isKinematic = false;
  39. }
  40.  
  41. if (Input.GetKeyDown(KeyCode.Alpha9))
  42. {
  43. rigidbody.isKinematic = true;
  44. rigidbody.velocity = Vector3.zero;
  45. rigidbody.angularVelocity = Vector3.zero;
  46. transform.position = ObjectSpawn1.transform.position;
  47. transform.rotation = ObjectSpawn1.transform.rotation;
  48. rigidbody.isKinematic = false;
  49. }
  50.  
  51. if (Input.GetKeyDown(KeyCode.Alpha0))
  52. {
  53. rigidbody.isKinematic = true;
  54. rigidbody.velocity = Vector3.zero;
  55. rigidbody.angularVelocity = Vector3.zero;
  56. transform.position = ObjectSpawn1.transform.position;
  57. transform.rotation = ObjectSpawn1.transform.rotation;
  58. rigidbody.isKinematic = false;
  59. }
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement