17 lines
496 B
C#
17 lines
496 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class LookCamera : MonoBehaviour
|
|
{
|
|
private void Update()
|
|
{
|
|
// 平滑朝向玩家
|
|
Vector3 targetDir = GameLocal.Ins.self.transform.position - transform.position;
|
|
targetDir.y = 0f;
|
|
Quaternion targetRotation = Quaternion.LookRotation(targetDir);
|
|
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2f);
|
|
}
|
|
}
|