22 lines
515 B
C#
22 lines
515 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class MinimapBillboardZ : MonoBehaviour
|
|
{
|
|
Vector3 lookat;
|
|
Quaternion lookRotation;
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
lookat = Vector3.up;
|
|
|
|
// Make the object face the camera only in the Y-axis
|
|
lookRotation = Quaternion.LookRotation(new Vector3(lookat.x, -lookat.y, 0));
|
|
|
|
// Apply the rotation to the object
|
|
transform.rotation = lookRotation;
|
|
}
|
|
}
|