You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
631 B
26 lines
631 B
using UnityEngine;
|
|
|
|
namespace ARLocation.Utils
|
|
{
|
|
|
|
public class FaceCamera : MonoBehaviour
|
|
{
|
|
private Transform mainCameraTransform;
|
|
|
|
// Use this for initialization
|
|
void Start()
|
|
{
|
|
if (Camera.main != null) mainCameraTransform = Camera.main.transform;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
var position = mainCameraTransform.position;
|
|
Vector3 v = position - transform.position;
|
|
v.x = v.z = 0.0f;
|
|
transform.LookAt(position - v);
|
|
transform.Rotate(0, 180, 0);
|
|
}
|
|
}
|
|
}
|