Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- public class savecheckpoint : MonoBehaviour
- {
- public GameObject player;
- public GameObject respawnPoint;
- public Transform respawnPoint1;
- // Start is called before the first frame update
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- }
- private void OnTriggerEnter(Collider other)
- {
- if (other.gameObject.CompareTag("Checkpoint"))
- {
- //Scene currentScene = SceneManager.GetActiveScene();
- // SceneManager.LoadScene(currentScene.name);
- Rigidbody rb = GetComponent<Rigidbody>();
- respawnPoint1.transform.position = other.transform.position + new Vector3 (0, -2, 0);
- respawnPoint1.transform.rotation = other.transform.rotation;
- rb.velocity = Vector3.zero;
- rb.angularVelocity = Vector3.zero;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment