18 [Tooltip(
"Offsets the scale ratio so that text does not scale down too much. (Set to zero for linear scaling)")]
21 private float sizeRatio = 0.0f;
22 public float SizeRatio
24 get {
return sizeRatio; }
32 else if (value > 1.0f)
46 private Vector3 startingScale;
51 private float startingDistance;
57 startingDistance = Vector3.Distance(
CameraCache.
Main.transform.position, transform.position);
58 startingScale = transform.localScale;
60 SetSizeRatio(SizeRatio);
71 if (startingDistance > 0.0f)
74 SizeRatio = 1 / startingDistance;
84 Debug.LogWarning(
"The object and the camera are in the same position at Start(). The attached FixedAngularSize Behaviour is now disabled.");
85 #endif // UNITY_EDITOR 97 private void LateUpdate()
99 float distanceToHologram = Vector3.Distance(
CameraCache.
Main.transform.position, transform.position);
102 float curvedRatio = 1 - startingDistance * SizeRatio;
103 transform.localScale = startingScale * (distanceToHologram * SizeRatio + curvedRatio);