Testing jpeg cardboard box background in Rhythm Rally

This commit is contained in:
Braedon
2022-02-12 04:08:24 -05:00
parent a3e39f0cdd
commit 49f724f08a
18 changed files with 1356 additions and 112 deletions

View File

@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RhythmHeavenMania.Common
{
public class Billboard : MonoBehaviour
{
public float fixedSize = 0.03f;
public bool constantScale = false;
private Camera cam;
private void Start()
{
cam = GameManager.instance.GameCamera;
}
private void LateUpdate()
{
this.transform.rotation = cam.transform.rotation;
if (constantScale)
{
var distance = (cam.transform.position - this.transform.position).magnitude;
var size = distance * fixedSize * cam.fieldOfView;
this.transform.localScale = Vector3.one * size;
transform.forward = transform.position - cam.transform.position;
}
}
}
}