llealloo / audiolink

Audio reactive prefabs for VRChat
Other
354 stars 40 forks source link

Multiple audio links for larger worlds or at least a way to add multiple audio sources? #205

Closed aldumgames closed 1 year ago

aldumgames commented 1 year ago

I have quite a large world and I have 2 spaces that need audio link for 2 separate players one on an outdoor stage and another for an interior club. just an idea.

float3 commented 1 year ago

You can change the AudioSource at runtime. Switch when players go from one area to the other. Would that work for you?

aldumgames commented 1 year ago

how would i do that

float3 commented 1 year ago

something like this

using UdonSharp;
using UnityEngine;
using VRCAudioLink;

public class AudioSourceSwitch : UdonSharpBehaviour
{
    [SerializeField] public AudioLink audioLink;
    [SerializeField] public AudioSource[] AudioSources;

    void SwitchAudioSource()
    {
        if (audioLink.audioSource == AudioSources[0])
        {
            audioLink.audioSource = AudioSources[1];
        }
        else
        {
            audioLink.audioSource = AudioSources[0];
        }
    }
}
float3 commented 1 year ago

Now make a collider and on player collision call the SwitchAudioSource method

float3 commented 1 year ago

https://docs.vrchat.com/docs/player-collisions

aldumgames commented 1 year ago

this method is proving more difficult because of the layout, the world has teleport points to different areas and find your friends so i don't know how to set it up. its easy for someone to bypass the collider

aldumgames commented 1 year ago

i also have no idea how to tell it to call the script

float3 commented 1 year ago

In that case, it's even simpler since you can build the audio source switch right into the teleport system

float3 commented 1 year ago

I can help you with implementing that; it should be pretty straightforward.

Are you willing to join the AudioLink discord?

aldumgames commented 1 year ago

yeah sure

aldumgames commented 1 year ago

i have joined