using FMODUnity;
using UnityEngine;

public class AudioDropRigidBody : MonoBehaviour
{
    [SerializeField] public EventReference clip;
    
    private void OnCollisionEnter(Collision other)
    {
        var magnitude = other.relativeVelocity.sqrMagnitude / 10f;
        if (magnitude > 1f)
        {
            magnitude = 1f;
        }

        if (magnitude < 0.1f) return;
        
        var pos = other.contacts[0].point;

        RuntimeManager.PlayOneShot(clip.Guid, pos);
    }
}
