Answers for "world space constant size"

C#
0

world space constant size

public float downScaling; // to configure the size
private float _distance;
private Canvas _canvas;

private void Update()
{
	_distance = Vector3.Distance(_canvas.transform.position, _canvas.worldCamera.transform.position);
    _canvas.transform.localScale = Vector3.one * _distance / downScaling;

    _canvas.transform.LookAt(_canvas.worldCamera.transform); // canvas content needs to be flipped 180°
}
Posted by: Guest on August-30-2021

C# Answers by Framework

Browse Popular Code Answers by Language