August 2018
Beginner
334 pages
10h 19m
English
We can develop a more flexible algorithm by defining different types of walls that affect sound intensity. It works by casting rays and adding up their values to the sound attenuation:
public Dictionary<string, float> wallTypes;
intensity -= GetWallAttenuation(emitterPos, srPos);
public float GetWallAttenuation(Vector3 emitterPos, Vector3 receiverPos)
{
// next steps here
}
float attenuation = 0f; Vector3 direction = receiverPos - emitterPos; float distance = direction.magnitude; ...
Read now
Unlock full access