soundvision/UnityProject/Assets/Scenes/Examples/First Project/Scripts/FaceCamera.cs

18 lines
382 B
C#
Raw Normal View History

2020-01-21 22:31:06 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FaceCamera : MonoBehaviour
{
[SerializeField] Transform target;
void Update()
{
if (target != null)
{
transform.LookAt(transform.position + target.transform.rotation * Vector3.forward, target.transform.rotation * Vector3.up);
}
}
}