diff options
author | UbitUmarov | 2012-05-17 12:17:29 +0100 |
---|---|---|
committer | UbitUmarov | 2012-05-17 12:17:29 +0100 |
commit | 6af78836a540c9b0a5972ab241364dae52e8e74d (patch) | |
tree | 7ff42a8f3d265e54f8ca51695f75a3daaa225d11 /OpenSim/Region/Framework/Scenes/CollisionSounds.cs | |
parent | increase avatars collisions report to 10 per sec, Stopped sound on avatar to ... (diff) | |
download | opensim-SC-6af78836a540c9b0a5972ab241364dae52e8e74d.zip opensim-SC-6af78836a540c9b0a5972ab241364dae52e8e74d.tar.gz opensim-SC-6af78836a540c9b0a5972ab241364dae52e8e74d.tar.bz2 opensim-SC-6af78836a540c9b0a5972ab241364dae52e8e74d.tar.xz |
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
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/CollisionSounds.cs | 25 |
1 files changed, 18 insertions, 7 deletions
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 | |||
130 | if(Colliders.Count == 0 || part == null) | 130 | if(Colliders.Count == 0 || part == null) |
131 | return; | 131 | return; |
132 | 132 | ||
133 | if ((part.Flags & PrimFlags.Physics) == 0) // let only active prims trigger sounds | 133 | if (part.VolumeDetectActive || (part.Flags & PrimFlags.Physics) == 0) |
134 | return; | 134 | return; |
135 | 135 | ||
136 | if (part.ParentGroup == null) | 136 | if (part.ParentGroup == null) |
@@ -142,6 +142,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
142 | UUID soundID; | 142 | UUID soundID; |
143 | int otherMaterial; | 143 | int otherMaterial; |
144 | 144 | ||
145 | Vector3 position = part.AbsolutePosition; | ||
146 | |||
147 | if (part.CollisionSound != UUID.Zero) | ||
148 | { | ||
149 | if (part.CollisionSoundVolume > 0.0f) | ||
150 | part.SendCollisionSound(part.CollisionSound, part.CollisionSoundVolume, position); | ||
151 | return; | ||
152 | } | ||
153 | |||
145 | int thisMaterial = (int) part.Material; | 154 | int thisMaterial = (int) part.Material; |
146 | if (thisMaterial >= MaxMaterials) | 155 | if (thisMaterial >= MaxMaterials) |
147 | thisMaterial = 3; | 156 | thisMaterial = 3; |
@@ -158,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
158 | if (!doneownsound) | 167 | if (!doneownsound) |
159 | { | 168 | { |
160 | soundID = m_TerrainPart[thisMaterial]; | 169 | soundID = m_TerrainPart[thisMaterial]; |
161 | part.SendCollisionSound(soundID, 1.0); | 170 | part.SendCollisionSound(soundID, 1.0, position); |
162 | doneownsound = true; | 171 | doneownsound = true; |
163 | } | 172 | } |
164 | continue; | 173 | continue; |
@@ -170,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
170 | if (otherPart.CollisionSound == part.invalidCollisionSoundUUID || otherPart.VolumeDetectActive) | 179 | if (otherPart.CollisionSound == part.invalidCollisionSoundUUID || otherPart.VolumeDetectActive) |
171 | continue; | 180 | continue; |
172 | if (otherPart.CollisionSound != UUID.Zero) | 181 | if (otherPart.CollisionSound != UUID.Zero) |
173 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume); | 182 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, position); |
174 | else | 183 | else |
175 | { | 184 | { |
176 | otherMaterial = (int)otherPart.Material; | 185 | otherMaterial = (int)otherPart.Material; |
@@ -179,10 +188,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
179 | index = thisMatScaled + otherMaterial; | 188 | index = thisMatScaled + otherMaterial; |
180 | soundID = m_PartPart[index]; | 189 | soundID = m_PartPart[index]; |
181 | if (doneownsound) | 190 | if (doneownsound) |
182 | otherPart.SendCollisionSound(soundID, 1.0); | 191 | otherPart.SendCollisionSound(soundID, 1.0, position); |
183 | else | 192 | else |
184 | { | 193 | { |
185 | part.SendCollisionSound(soundID, 1.0); | 194 | part.SendCollisionSound(soundID, 1.0, position); |
186 | doneownsound = true; | 195 | doneownsound = true; |
187 | } | 196 | } |
188 | } | 197 | } |
@@ -217,6 +226,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
217 | int index; | 226 | int index; |
218 | // bool doneownsound = false; | 227 | // bool doneownsound = false; |
219 | 228 | ||
229 | Vector3 position = av.AbsolutePosition; | ||
230 | |||
220 | foreach (uint Id in Colliders) | 231 | foreach (uint Id in Colliders) |
221 | { | 232 | { |
222 | if (Id == 0) | 233 | if (Id == 0) |
@@ -230,7 +241,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
230 | if (otherPart.CollisionSound == otherPart.invalidCollisionSoundUUID) | 241 | if (otherPart.CollisionSound == otherPart.invalidCollisionSoundUUID) |
231 | continue; | 242 | continue; |
232 | if (otherPart.CollisionSound != UUID.Zero) | 243 | if (otherPart.CollisionSound != UUID.Zero) |
233 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume); | 244 | otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, position); |
234 | else | 245 | else |
235 | { | 246 | { |
236 | otherMaterial = (int)otherPart.Material; | 247 | otherMaterial = (int)otherPart.Material; |
@@ -238,7 +249,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
238 | otherMaterial = 3; | 249 | otherMaterial = 3; |
239 | index = thisMatScaled + otherMaterial; | 250 | index = thisMatScaled + otherMaterial; |
240 | soundID = m_PartPart[index]; | 251 | soundID = m_PartPart[index]; |
241 | otherPart.SendCollisionSound(soundID, 1.0); | 252 | otherPart.SendCollisionSound(soundID, 1.0, position); |
242 | } | 253 | } |
243 | } | 254 | } |
244 | /* | 255 | /* |