19 lines
432 B
C#
19 lines
432 B
C#
using UnityEngine;
|
|
|
|
public class DiceFollowCamera : MonoBehaviour
|
|
{
|
|
[SerializeField] private Transform dice;
|
|
[SerializeField] private Vector3 offset = new Vector3(0f, 3f, -3f);
|
|
|
|
void LateUpdate()
|
|
{
|
|
if (!dice) return;
|
|
|
|
// Follow position only
|
|
transform.position = dice.position + offset;
|
|
|
|
// Lock rotation completely
|
|
transform.rotation = Quaternion.Euler(90f, 0f, 0f);
|
|
}
|
|
}
|