Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class camtrigger : MonoBehaviour
- {
- private bool islerping = false;
- public GameObject _camera;
- public GameObject campos;
- public float speed = 1;
- // Start is called before the first frame update
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- if (islerping == true)
- {
- _camera.transform.position = Vector3.Slerp(_camera.transform.position, campos.transform.position, speed * Time.deltaTime);
- _camera.transform.rotation = Quaternion.Slerp(_camera.transform.rotation, campos.transform.rotation, speed * Time.deltaTime);
- }
- }
- private void OnTriggerEnter(Collider other)
- {
- if (other.gameObject.tag == "Player")
- {
- islerping = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement