SHARE
TWEET

test

a guest Nov 19th, 2019 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class camtrigger : MonoBehaviour
  6. {
  7.     private bool islerping = false;
  8.     public GameObject _camera;
  9.     public GameObject campos;
  10.     public float speed = 1;
  11.  
  12.     // Start is called before the first frame update
  13.     void Start()
  14.     {
  15.        
  16.     }
  17.  
  18.     // Update is called once per frame
  19.     void Update()
  20.     {
  21.         if (islerping == true)
  22.         {
  23.             _camera.transform.position = Vector3.Slerp(_camera.transform.position, campos.transform.position, speed * Time.deltaTime);
  24.             _camera.transform.rotation = Quaternion.Slerp(_camera.transform.rotation, campos.transform.rotation, speed * Time.deltaTime);
  25.         }
  26.     }
  27.     private void OnTriggerEnter(Collider other)
  28.     {
  29.         if (other.gameObject.tag == "Player")
  30.         {
  31.             islerping = true;
  32.         }
  33.     }
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top