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

20 lines
516 B
C#
Raw Normal View History

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