soundvision/UnityProject/Assets/Scenes/Examples/Composition/script/BallMapping.cs

20 lines
508 B
C#
Raw Permalink Normal View History

2019-08-17 15:47:01 +00:00
using UnityEngine;
2019-10-04 19:58:32 +00:00
namespace cylvester
2019-08-17 15:47:01 +00:00
{
public class BallMapping : MonoBehaviour
{
2019-10-04 19:58:32 +00:00
[SerializeField] private GameObject ball = null;
2019-08-17 15:47:01 +00:00
[SerializeField] private float mapToSize = 10f;
2019-10-04 19:58:32 +00:00
[SerializeField] private RmsAnalyzer analyzer = null;
2019-08-17 15:47:01 +00:00
void Update()
{
var currentRms = analyzer.RMS;
var scale = currentRms * mapToSize;
ball.transform.localScale = new Vector3(scale, scale, scale);
}
}
}