feat: tvHeads

This commit is contained in:
Alexandre Coirier
2026-06-05 22:53:25 +02:00
parent 8fceff4761
commit 78a7a2b811
2 changed files with 4 additions and 1196 deletions
@@ -35,7 +35,6 @@ public class TvHead : MonoBehaviour
private float _onDuration;
private Vector4 _headColor;
private Vector4 _screenColor;
private Quaternion _headOriginRot;
const string ColorAttribute = "_Color";
@@ -46,7 +45,6 @@ public class TvHead : MonoBehaviour
_onDuration = Mathf.Lerp(_settings.OnMin, _settings.OnMax, (_seed * 4.56f) % 1);
_headColor = _references.Ray.material.GetColor(ColorAttribute);
_screenColor = _references.Head.materials[1].GetColor(ColorAttribute);
_headOriginRot = _references.Head.transform.localRotation;
//Off();
}
@@ -63,15 +61,11 @@ public class TvHead : MonoBehaviour
noisedValue = Mathf.Clamp01(noisedValue);
Vector3 lookDir = (Camera.main.transform.position - _references.Head.transform.position).normalized;
//lookDir = transform.TransformDirection(lookDir);
Vector3 up = Vector3.up;
//Quaternion targetRot = Quaternion.LookRotation(lookDir, up);
Quaternion targetRot = Quaternion.Euler(0, 0, 0);
targetRot *= Quaternion.Inverse(transform.parent.rotation);
//targetRot *= _headOriginRot;
//targetRot = Quaternion.Lerp(_headOriginRot, targetRot, Mathf.Lerp(_value, noisedValue, .5f));
Quaternion targetRot = Quaternion.Inverse(_references.Head.transform.parent.rotation);
targetRot *= Quaternion.LookRotation(lookDir, Vector3.up);
targetRot *= _references.Head.transform.parent.localRotation;
targetRot = Quaternion.Lerp(Quaternion.Euler(0, 0, 0), targetRot, Mathf.Lerp(_value, noisedValue, .5f));
Color headColor = Color.Lerp(Color.black, _headColor , noisedValue);
Color screenColor = Color.Lerp(Color.black, _screenColor, noisedValue);