GUPPYYYY

Untitled

Sep 10th, 2025
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5. public class savecheckpoint : MonoBehaviour
  6. {
  7. public GameObject player;
  8. public GameObject respawnPoint;
  9. public Transform respawnPoint1;
  10. // Start is called before the first frame update
  11. void Start()
  12. {
  13.  
  14. }
  15.  
  16. // Update is called once per frame
  17. void Update()
  18. {
  19.  
  20. }
  21. private void OnTriggerEnter(Collider other)
  22. {
  23. if (other.gameObject.CompareTag("Checkpoint"))
  24. {
  25. //Scene currentScene = SceneManager.GetActiveScene();
  26. // SceneManager.LoadScene(currentScene.name);
  27.  
  28. Rigidbody rb = GetComponent<Rigidbody>();
  29.  
  30. respawnPoint1.transform.position = other.transform.position + new Vector3 (0, -2, 0);
  31. respawnPoint1.transform.rotation = other.transform.rotation;
  32. rb.velocity = Vector3.zero;
  33. rb.angularVelocity = Vector3.zero;
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment