Anon2559

audiooverrideudon.cs

Jan 19th, 2021 (edited)
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. using UdonSharp;
  2. using UnityEngine;
  3. using VRC.SDKBase;
  4. using VRC.Udon;
  5.  
  6. public class audiooverrideudon : UdonSharpBehaviour
  7. {
  8. Collider m_collider; //Needs to be placed on a gameobject with a trigger collider
  9. public float maxDistance ;
  10. public float defaultDistance ;
  11.  
  12. // Use this for initialization
  13. void Start () {
  14. m_collider = GetComponent<Collider>();
  15. }
  16. //SOS Audio Overrides
  17. //Note you need to place these without the players being in them at spawn
  18. public override void OnPlayerTriggerEnter(VRCPlayerApi player)
  19. {
  20. player.SetVoiceDistanceFar(maxDistance);
  21. player.SetAvatarAudioFarRadius(maxDistance);
  22. }
  23. public override void OnPlayerTriggerExit(VRCPlayerApi player)
  24. {
  25. player.SetVoiceDistanceFar(defaultDistance);
  26. player.SetAvatarAudioFarRadius(defaultDistance);
  27. }
  28.  
  29. }
  30.  
Add Comment
Please, Sign In to add comment