1234567891011121314151617181920 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class MyCameraController : MonoBehaviour
- {
- public Vector3 offset = new Vector3(0, -10, 10);
- public Transform player;
- void Start()
- {
- }
- void Update()
- {
- transform.position = Vector3.Lerp(transform.position, player.position - offset, Time.deltaTime * 5);
- Quaternion rotation = Quaternion.LookRotation(player.position - transform.position);
- transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * 3f);
- }
- }
|