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 | |
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 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 20 |
2 files changed, 22 insertions, 23 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 | /* |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5874d34..b5705b7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2632,7 +2632,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2632 | 2632 | ||
2633 | else | 2633 | else |
2634 | { | 2634 | { |
2635 | |||
2636 | // calculate things that started colliding this time | 2635 | // calculate things that started colliding this time |
2637 | // and build up list of colliders this time | 2636 | // and build up list of colliders this time |
2638 | foreach (uint localid in collissionswith.Keys) | 2637 | foreach (uint localid in collissionswith.Keys) |
@@ -2657,22 +2656,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2657 | foreach (uint localID in endedColliders) | 2656 | foreach (uint localID in endedColliders) |
2658 | m_lastColliders.Remove(localID); | 2657 | m_lastColliders.Remove(localID); |
2659 | } | 2658 | } |
2659 | |||
2660 | // play the sound. | 2660 | // play the sound. |
2661 | 2661 | ||
2662 | bool IsNotVolumeDtc = !VolumeDetectActive; | 2662 | bool IsNotVolumeDtc = !VolumeDetectActive; |
2663 | 2663 | ||
2664 | if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSound != invalidCollisionSoundUUID) | 2664 | if (IsNotVolumeDtc && startedColliders.Count > 0 && CollisionSound != invalidCollisionSoundUUID) |
2665 | { | 2665 | CollisionSounds.PartCollisionSound(this, startedColliders); |
2666 | if (CollisionSound != UUID.Zero) | ||
2667 | { | ||
2668 | if (CollisionSoundVolume > 0.0f) | ||
2669 | SendCollisionSound(CollisionSound, CollisionSoundVolume); | ||
2670 | } | ||
2671 | else | ||
2672 | { | ||
2673 | CollisionSounds.PartCollisionSound(this, startedColliders); | ||
2674 | } | ||
2675 | } | ||
2676 | 2666 | ||
2677 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); | 2667 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); |
2678 | if (IsNotVolumeDtc) | 2668 | if (IsNotVolumeDtc) |
@@ -3206,12 +3196,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3206 | } | 3196 | } |
3207 | } | 3197 | } |
3208 | 3198 | ||
3209 | public void SendCollisionSound(UUID soundID, double volume) | 3199 | public void SendCollisionSound(UUID soundID, double volume, Vector3 position) |
3210 | { | 3200 | { |
3211 | if (soundID == UUID.Zero) | 3201 | if (soundID == UUID.Zero) |
3212 | return; | 3202 | return; |
3213 | 3203 | ||
3214 | |||
3215 | ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>(); | 3204 | ISoundModule soundModule = ParentGroup.Scene.RequestModuleInterface<ISoundModule>(); |
3216 | if (soundModule == null) | 3205 | if (soundModule == null) |
3217 | return; | 3206 | return; |
@@ -3230,10 +3219,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3230 | UUID ownerID = OwnerID; | 3219 | UUID ownerID = OwnerID; |
3231 | UUID objectID = ParentGroup.RootPart.UUID; | 3220 | UUID objectID = ParentGroup.RootPart.UUID; |
3232 | UUID parentID = ParentGroup.UUID; | 3221 | UUID parentID = ParentGroup.UUID; |
3233 | Vector3 position = AbsolutePosition; // region local | ||
3234 | ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; | 3222 | ulong regionHandle = ParentGroup.Scene.RegionInfo.RegionHandle; |
3235 | 3223 | ||
3236 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0); | 3224 | soundModule.TriggerSound(soundID, ownerID, objectID, parentID, volume, position, regionHandle, 0 ); |
3237 | } | 3225 | } |
3238 | 3226 | ||
3239 | 3227 | ||