From 6af78836a540c9b0a5972ab241364dae52e8e74d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 17 May 2012 12:17:29 +0100 Subject: trigger collision sounds on active agent position for better spatial effect without using the detailed collision position. (current error will be half max physical prim size). Moved some checks from sop to collisionSound code --- OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 25 ++++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/CollisionSounds.cs') diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs index c46756c..5d43027 100644 --- a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs +++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs @@ -130,7 +130,7 @@ namespace OpenSim.Region.Framework.Scenes if(Colliders.Count == 0 || part == null) return; - if ((part.Flags & PrimFlags.Physics) == 0) // let only active prims trigger sounds + if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0) return; if (part.ParentGroup == null) @@ -142,6 +142,15 @@ namespace OpenSim.Region.Framework.Scenes UUID soundID; int otherMaterial; + Vector3 position = part.AbsolutePosition; + + if (part.CollisionSound != UUID.Zero) + { + if (part.CollisionSoundVolume > 0.0f) + part.SendCollisionSound(part.CollisionSound, part.CollisionSoundVolume, position); + return; + } + int thisMaterial = (int) part.Material; if (thisMaterial >= MaxMaterials) thisMaterial = 3; @@ -158,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes if (!doneownsound) { soundID = m_TerrainPart[thisMaterial]; - part.SendCollisionSound(soundID, 1.0); + part.SendCollisionSound(soundID, 1.0, position); doneownsound = true; } continue; @@ -170,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes if (otherPart.CollisionSound == part.invalidCollisionSoundUUID || otherPart.VolumeDetectActive) continue; if (otherPart.CollisionSound != UUID.Zero) - otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume); + otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, position); else { otherMaterial = (int)otherPart.Material; @@ -179,10 +188,10 @@ namespace OpenSim.Region.Framework.Scenes index = thisMatScaled + otherMaterial; soundID = m_PartPart[index]; if (doneownsound) - otherPart.SendCollisionSound(soundID, 1.0); + otherPart.SendCollisionSound(soundID, 1.0, position); else { - part.SendCollisionSound(soundID, 1.0); + part.SendCollisionSound(soundID, 1.0, position); doneownsound = true; } } @@ -217,6 +226,8 @@ namespace OpenSim.Region.Framework.Scenes int index; // bool doneownsound = false; + Vector3 position = av.AbsolutePosition; + foreach (uint Id in Colliders) { if (Id == 0) @@ -230,7 +241,7 @@ namespace OpenSim.Region.Framework.Scenes if (otherPart.CollisionSound == otherPart.invalidCollisionSoundUUID) continue; if (otherPart.CollisionSound != UUID.Zero) - otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume); + otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, position); else { otherMaterial = (int)otherPart.Material; @@ -238,7 +249,7 @@ namespace OpenSim.Region.Framework.Scenes otherMaterial = 3; index = thisMatScaled + otherMaterial; soundID = m_PartPart[index]; - otherPart.SendCollisionSound(soundID, 1.0); + otherPart.SendCollisionSound(soundID, 1.0, position); } } /* -- cgit v1.1