Add billboard behaviour component

This commit is contained in:
2023-07-08 14:36:38 +02:00
parent 27341fd1b1
commit 2f70d6949f
3 changed files with 799 additions and 6 deletions

View File

@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BillboardBehaviour : MonoBehaviour
{
private Vector3 initialRotation;
// Start is called before the first frame update
void Start()
{
initialRotation = transform.rotation.eulerAngles;
}
// Update is called once per frame
void Update()
{
transform.LookAt(Camera.main.transform.position);
transform.rotation = Quaternion.Euler(new Vector3(initialRotation.x, transform.rotation.eulerAngles.y, initialRotation.z));
}
}