Merge pull request #4916 from daniel-abbott/audio_sound_positioning_fix
[examples] PR for #4904, calculate 'right' Vector3 to correctly perform audio positioning.
This commit is contained in:
commit
3a1d6261e2
1 changed files with 2 additions and 2 deletions
|
@ -108,7 +108,7 @@ static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, flo
|
|||
// Calculate normalized vectors for spatial positioning
|
||||
Vector3 normalizedDirection = Vector3Normalize(direction);
|
||||
Vector3 forward = Vector3Normalize(Vector3Subtract(listener.target, listener.position));
|
||||
Vector3 right = Vector3Normalize(Vector3CrossProduct(forward, listener.up));
|
||||
Vector3 right = Vector3Normalize(Vector3CrossProduct(listener.up, forward));
|
||||
|
||||
// Reduce volume for sounds behind the listener
|
||||
float dotProduct = Vector3DotProduct(forward, normalizedDirection);
|
||||
|
@ -120,4 +120,4 @@ static void SetSoundPosition(Camera listener, Sound sound, Vector3 position, flo
|
|||
// Apply final sound properties
|
||||
SetSoundVolume(sound, attenuation);
|
||||
SetSoundPan(sound, pan);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue