19 lines
616 B
C#
19 lines
616 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Valheim
|
|
{
|
|
public class FollowCamera : MonoBehaviour
|
|
{
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
Transform camT = Camera.main.transform;
|
|
Vector3 cameraForward = new Vector3(camT.forward.x, camT.forward.y, camT.forward.z);
|
|
transform.position = camT.transform.position;
|
|
Quaternion quaternion = Quaternion.LookRotation(cameraForward);
|
|
transform.rotation = Quaternion.Slerp(transform.rotation, quaternion, 0.1f);
|
|
}
|
|
}
|
|
} |