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 SimpleFollowCamera : MonoBehaviour
- {
- public GameObject Target;
- public float CameraSpeed = 4f;
- Vector3 Startoffset = Vector3.zero;
- // Start is called before the first frame update
- void Start()
- {
- Startoffset = this.transform.position - Target.transform.position;
- }
- // FixedUpdate is called 50 times per second
- void FixedUpdate()
- {
- Vector3 CameraPinnedPos = Target.transform.position + Startoffset;
- this.transform.position = Vector3.Slerp(this.transform.position, CameraPinnedPos,Time.deltaTime * CameraSpeed);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement