(スクリプト)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HeadController : MonoBehaviour
{
private Quaternion targetRotation;
void Start()
{
targetRotation = transform.rotation;
}
void Update()
{
var rotationHorizontal = Quaternion.AngleAxis(Camera.main.transform.eulerAngles.y, Vector3.up);
transform.rotation = Quaternion.Lerp(transform.rotation, rotationHorizontal, 0.02f);
}
}
(実行結果)