From e9e797b6814b960b140094bbff137e38f96d4ca8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 15 May 2012 00:15:44 +0200 Subject: [PATCH 1/9] Fix an omission --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f7edd31ed4..48844695fb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2564,7 +2564,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - if ((ParentGroup.RootPart.ScriptEvents & scriptEvents.collision_start) != 0) + if ((ParentGroup.RootPart.ScriptEvents & ev) != 0) sendToRoot = true; } if (sendToRoot && ParentGroup.RootPart != this) From 0fb663272abe8e78b15a10359a91974db003662b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 14 May 2012 23:42:45 +0100 Subject: [PATCH 2/9] make llGetCameraPos and llGetCameraRot apply to avatar that granted permission and not owner --- .../Shared/Api/Implementation/LSL_Api.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6523c2dd18..10bddbdda9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10525,7 +10525,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Vector(); m_host.TaskInventory.LockItemsForRead(true); - if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) + + UUID agentID = m_host.TaskInventory[invItemID].PermsGranter; + +// if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) + if (agentID == UUID.Zero) { m_host.TaskInventory.LockItemsForRead(false); return new LSL_Vector(); @@ -10539,7 +10543,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } m_host.TaskInventory.LockItemsForRead(false); - ScenePresence presence = World.GetScenePresence(m_host.OwnerID); +// ScenePresence presence = World.GetScenePresence(m_host.OwnerID); + ScenePresence presence = World.GetScenePresence(agentID); if (presence != null) { LSL_Vector pos = new LSL_Vector(presence.CameraPosition.X, presence.CameraPosition.Y, presence.CameraPosition.Z); @@ -10556,7 +10561,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Rotation(); m_host.TaskInventory.LockItemsForRead(true); - if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) + + UUID agentID = m_host.TaskInventory[invItemID].PermsGranter; + +// if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero) + if (agentID == UUID.Zero) { m_host.TaskInventory.LockItemsForRead(false); return new LSL_Rotation(); @@ -10569,7 +10578,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } m_host.TaskInventory.LockItemsForRead(false); - ScenePresence presence = World.GetScenePresence(m_host.OwnerID); +// ScenePresence presence = World.GetScenePresence(m_host.OwnerID); + ScenePresence presence = World.GetScenePresence(agentID); if (presence != null) { return new LSL_Rotation(presence.CameraRotation.X, presence.CameraRotation.Y, presence.CameraRotation.Z, presence.CameraRotation.W); From 325973d36f98a4b2fb0291e8bdc0063c4264329d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 15 May 2012 01:40:46 +0100 Subject: [PATCH 3/9] don't send colision events to volume detectors --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 48844695fb..81244ef6c9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2631,7 +2631,8 @@ namespace OpenSim.Region.Framework.Scenes SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); - SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); + if(!ParentGroup.RootPart.VolumeDetectActive) + SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); if (startedColliders.Contains(0)) From 995cd25f3027e1debb0ae5fc60b5dde831c31d17 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 15 May 2012 02:36:11 +0200 Subject: [PATCH 4/9] Port the mel/dahlia fix --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 9 ++++++++- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 33c184fc11..ec7a45448f 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -170,6 +170,7 @@ namespace OpenSim.Data.MySQL "ParticleSystem, ClickAction, Material, " + "CollisionSound, CollisionSoundVolume, " + "PassTouches, " + + "PassCollisions, " + "LinkNumber, MediaURL, KeyframeMotion, " + "PhysicsShapeType, Density, GravityModifier, " + "Friction, Restitution) values (" + "?UUID, " + @@ -203,7 +204,7 @@ namespace OpenSim.Data.MySQL "?SaleType, ?ColorR, ?ColorG, " + "?ColorB, ?ColorA, ?ParticleSystem, " + "?ClickAction, ?Material, ?CollisionSound, " + - "?CollisionSoundVolume, ?PassTouches, " + + "?CollisionSoundVolume, ?PassTouches, ?PassCollisions, " + "?LinkNumber, ?MediaURL, ?KeyframeMotion, " + "?PhysicsShapeType, ?Density, ?GravityModifier, " + "?Friction, ?Restitution)"; @@ -1231,6 +1232,7 @@ namespace OpenSim.Data.MySQL prim.CollisionSoundVolume = (float)(double)row["CollisionSoundVolume"]; prim.PassTouches = ((sbyte)row["PassTouches"] != 0); + prim.PassCollisions = ((sbyte)row["PassCollisions"] != 0); prim.LinkNum = (int)row["LinkNumber"]; if (!(row["MediaURL"] is System.DBNull)) @@ -1605,6 +1607,11 @@ namespace OpenSim.Data.MySQL else cmd.Parameters.AddWithValue("PassTouches", 0); + if (prim.PassCollisions) + cmd.Parameters.AddWithValue("PassCollisions", 1); + else + cmd.Parameters.AddWithValue("PassCollisions", 0); + cmd.Parameters.AddWithValue("LinkNumber", prim.LinkNum); cmd.Parameters.AddWithValue("MediaURL", prim.MediaUrl); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 81244ef6c9..7a1720cbae 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4706,6 +4706,9 @@ namespace OpenSim.Region.Framework.Scenes public void aggregateScriptEvents() { + if (ParentGroup == null || ParentGroup.RootPart == null) + return; + AggregateScriptEvents = 0; // Aggregate script events From 338be76e0a5974b95db2618b8318b76f6fe3e8a4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 15 May 2012 13:41:13 +0100 Subject: [PATCH 5/9] ubitODE: fix not reporting land collisions on same cases. --- .../Region/Physics/UbitOdePlugin/OdeScene.cs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 7367719679..dd912da814 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -620,8 +620,6 @@ namespace OpenSim.Region.Physics.OdePlugin return d.JointCreateContactPtr(world, contactgroup, contact); } - - private bool GetCurContactGeom(int index, ref d.ContactGeom newcontactgeom) { if (ContactgeomsArray == IntPtr.Zero || index >= contactsPerCollision) @@ -1153,6 +1151,31 @@ namespace OpenSim.Region.Physics.OdePlugin } } break; + case ActorTypes.Ground: + case ActorTypes.Unknown: + default: + switch ((ActorTypes)p2.PhysicsActorType) + { + case ActorTypes.Agent: + if (p2 is OdeCharacter) + { + cc2 = (OdeCharacter)p2; + obj2LocalID = cc2.m_localID; + if (p2events) + cc2.AddCollisionEvent(0, contact); + } + break; + case ActorTypes.Prim: + if (p2 is OdePrim) + { + cp2 = (OdePrim)p2; + obj2LocalID = cp2.m_localID; + if (p2events) + cp2.AddCollisionEvent(0, contact); + } + break; + } + break; } } From 9d675232359a30c56d2b68d50fe15958374ec773 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 15 May 2012 15:45:01 +0100 Subject: [PATCH 6/9] ubitODE: if stopped having collisions do report zero colisions once, so collision_end event can be triggered. Changed reports rate to the requested rate and not full ode rate. --- .../Region/Physics/UbitOdePlugin/ODEPrim.cs | 46 +++++++++++++++---- .../Region/Physics/UbitOdePlugin/OdeScene.cs | 6 ++- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 87a7e51832..5db4f1753e 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs @@ -194,8 +194,10 @@ namespace OpenSim.Region.Physics.OdePlugin public int givefakeori = 0; private Quaternion fakeori; - public int m_eventsubscription; - private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); + private int m_eventsubscription; + private int m_cureventsubscription; + private CollisionEventUpdate CollisionEventsThisFrame = null; + private bool SentEmptyCollisionsEvent; public volatile bool childPrim; @@ -931,12 +933,21 @@ namespace OpenSim.Region.Physics.OdePlugin public override void SubscribeEvents(int ms) { m_eventsubscription = ms; + m_cureventsubscription = 0; + if (CollisionEventsThisFrame == null) + CollisionEventsThisFrame = new CollisionEventUpdate(); + SentEmptyCollisionsEvent = false; _parent_scene.AddCollisionEventReporting(this); } public override void UnSubscribeEvents() { _parent_scene.RemoveCollisionEventReporting(this); + if (CollisionEventsThisFrame != null) + { + CollisionEventsThisFrame.Clear(); + CollisionEventsThisFrame = null; + } m_eventsubscription = 0; } @@ -944,7 +955,6 @@ namespace OpenSim.Region.Physics.OdePlugin { if (CollisionEventsThisFrame == null) CollisionEventsThisFrame = new CollisionEventUpdate(); - CollisionEventsThisFrame.AddCollider(CollidedWith, contact); } @@ -953,14 +963,34 @@ namespace OpenSim.Region.Physics.OdePlugin if (CollisionEventsThisFrame == null) return; - base.SendCollisionUpdate(CollisionEventsThisFrame); + if (m_cureventsubscription < m_eventsubscription) + return; - if (CollisionEventsThisFrame.m_objCollisionList.Count == 0) - CollisionEventsThisFrame = null; - else - CollisionEventsThisFrame = new CollisionEventUpdate(); + m_cureventsubscription = 0; + + int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; + + if (!SentEmptyCollisionsEvent || ncolisions > 0) + { + base.SendCollisionUpdate(CollisionEventsThisFrame); + + if (ncolisions == 0) + SentEmptyCollisionsEvent = true; + else + { + SentEmptyCollisionsEvent = false; + CollisionEventsThisFrame.Clear(); + } + } } + internal void AddCollisionFrameTime(int t) + { + // protect it from overflow crashing + if (m_cureventsubscription + t >= int.MaxValue) + m_cureventsubscription = 0; + m_cureventsubscription += t; + } public override bool SubscribedEvents() { if (m_eventsubscription > 0) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index dd912da814..ddfdea4f6c 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -1898,7 +1898,11 @@ namespace OpenSim.Region.Physics.OdePlugin case ActorTypes.Prim: OdePrim pobj = (OdePrim)obj; - pobj.SendCollisions(); + if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds)) + { + pobj.AddCollisionFrameTime((int)(ODE_STEPSIZE * 1000.0f)); + pobj.SendCollisions(); + } break; } } From ca14534b91342f55e30838ccafba25424628f5b4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 15 May 2012 15:54:02 +0100 Subject: [PATCH 7/9] sop: - added UpdatePhysicsSubscribedEvents() to update physics ator collision events subcription where needed. Made it consider also VolumeDtc and phantom cases. - added extra calls to it on physics ator proprieties changes. - Fixed land collisions reports. - Handle the case of physics sending a last zero colisions reports to trigger collision_end. - Made the physics collisions report rate be 20 per second. (needs review/testing) --- .../Framework/Scenes/SceneObjectPart.cs | 166 +++++++++++++----- 1 file changed, 118 insertions(+), 48 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 7a1720cbae..11d6b57b4b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -123,11 +123,17 @@ namespace OpenSim.Region.Framework.Scenes /// public const int ALL_SIDES = -1; - private const scriptEvents PhyscicsNeededSubsEvents = ( + private const scriptEvents PhysicsNeededSubsEvents = ( scriptEvents.collision | scriptEvents.collision_start | scriptEvents.collision_end | scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end ); - + private const scriptEvents PhyscicsPhantonSubsEvents = ( + scriptEvents.land_collision | scriptEvents.land_collision_start | scriptEvents.land_collision_end + ); + private const scriptEvents PhyscicsVolumeDtcSubsEvents = ( + scriptEvents.collision_start | scriptEvents.collision_end + ); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// @@ -1882,7 +1888,10 @@ namespace OpenSim.Region.Framework.Scenes { if ((!isPhantom || isPhysical || _VolumeDetectActive) && !ParentGroup.IsAttachment && !(Shape.PathCurve == (byte)Extrusion.Flexible)) + { AddToPhysics(isPhysical, isPhantom, building, isPhysical); + UpdatePhysicsSubscribedEvents(); // not sure if appliable here + } else PhysActor = null; // just to be sure } @@ -1975,6 +1984,7 @@ namespace OpenSim.Region.Framework.Scenes bool UsePhysics = ((dupe.Flags & PrimFlags.Physics) != 0); dupe.DoPhysicsPropertyUpdate(UsePhysics, true); +// dupe.UpdatePhysicsSubscribedEvents(); // not sure... } if (dupe.PhysActor != null) @@ -2602,30 +2612,45 @@ namespace OpenSim.Region.Framework.Scenes List endedColliders = new List(); List startedColliders = new List(); - // calculate things that started colliding this time - // and build up list of colliders this time - foreach (uint localid in collissionswith.Keys) + if (collissionswith.Count == 0) { - thisHitColliders.Add(localid); - if (!m_lastColliders.Contains(localid)) - startedColliders.Add(localid); - } + if (m_lastColliders.Count == 0) + return; // nothing to do - // calculate things that ended colliding - foreach (uint localID in m_lastColliders) - { - if (!thisHitColliders.Contains(localID)) + foreach (uint localID in m_lastColliders) + { endedColliders.Add(localID); + } + m_lastColliders.Clear(); } - //add the items that started colliding this time to the last colliders list. - foreach (uint localID in startedColliders) - m_lastColliders.Add(localID); + else + { - // remove things that ended colliding from the last colliders list - foreach (uint localID in endedColliders) - m_lastColliders.Remove(localID); + // calculate things that started colliding this time + // and build up list of colliders this time + foreach (uint localid in collissionswith.Keys) + { + thisHitColliders.Add(localid); + if (!m_lastColliders.Contains(localid)) + startedColliders.Add(localid); + } + // calculate things that ended colliding + foreach (uint localID in m_lastColliders) + { + if (!thisHitColliders.Contains(localID)) + endedColliders.Add(localID); + } + + //add the items that started colliding this time to the last colliders list. + foreach (uint localID in startedColliders) + m_lastColliders.Add(localID); + + // remove things that ended colliding from the last colliders list + foreach (uint localID in endedColliders) + m_lastColliders.Remove(localID); + } // play the sound. if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); @@ -2636,12 +2661,9 @@ namespace OpenSim.Region.Framework.Scenes SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); if (startedColliders.Contains(0)) - { - if (m_lastColliders.Contains(0)) - SendLandCollisionEvent(scriptEvents.land_collision, ParentGroup.Scene.EventManager.TriggerScriptLandColliding); - else - SendLandCollisionEvent(scriptEvents.land_collision_start, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingStart); - } + SendLandCollisionEvent(scriptEvents.land_collision_start, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingStart); + if (m_lastColliders.Contains(0)) + SendLandCollisionEvent(scriptEvents.land_collision, ParentGroup.Scene.EventManager.TriggerScriptLandColliding); if (endedColliders.Contains(0)) SendLandCollisionEvent(scriptEvents.land_collision_end, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd); } @@ -4383,26 +4405,28 @@ namespace OpenSim.Region.Framework.Scenes { if (pa == null) { - AddToPhysics(UsePhysics, SetPhantom, building , false); + AddToPhysics(UsePhysics, SetPhantom, building, false); pa = PhysActor; - - if (pa != null) - { - if ( -// ((AggregateScriptEvents & scriptEvents.collision) != 0) || -// ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || -// ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || -// ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || -// ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || -// ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || - ((AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) -// (CollisionSound != UUID.Zero) - ) - { - pa.OnCollisionUpdate += PhysicsCollision; - pa.SubscribeEvents(1000); - } - } + /* + if (pa != null) + { + if ( + // ((AggregateScriptEvents & scriptEvents.collision) != 0) || + // ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || + // ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || + // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || + // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || + // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || + ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || + ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || + (CollisionSound != UUID.Zero) + ) + { + pa.OnCollisionUpdate += PhysicsCollision; + pa.SubscribeEvents(1000); + } + } + */ } else // it already has a physical representation @@ -4414,9 +4438,13 @@ namespace OpenSim.Region.Framework.Scenes else pa.SetVolumeDetect(0); */ + + if (pa.Building != building) pa.Building = building; } + + UpdatePhysicsSubscribedEvents(); } } @@ -4539,8 +4567,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// This isn't the same as turning off physical, since even without being physical the prim has a physics - /// representation for collision detection. Rather, this would be used in situations such as making a prim - /// phantom. + /// representation for collision detection. /// public void RemoveFromPhysics() { @@ -4704,6 +4731,46 @@ namespace OpenSim.Region.Framework.Scenes ScheduleFullUpdate(); } + + private void UpdatePhysicsSubscribedEvents() + { + PhysicsActor pa = PhysActor; + if (pa == null) + return; + + pa.OnCollisionUpdate -= PhysicsCollision; + + bool hassound = ( CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f); + scriptEvents CombinedEvents = AggregateScriptEvents; + + // merge with root part + if (ParentGroup != null && ParentGroup.RootPart != null) + CombinedEvents |= ParentGroup.RootPart.AggregateScriptEvents; + + // submit to this part case + if (VolumeDetectActive) + { + CombinedEvents &= PhyscicsVolumeDtcSubsEvents; + hassound = false; + } + else if ((Flags & PrimFlags.Phantom) != 0) + CombinedEvents &= PhyscicsPhantonSubsEvents; + else + CombinedEvents &= PhysicsNeededSubsEvents; + + if (hassound || CombinedEvents != 0) + { + // subscribe to physics updates. + pa.OnCollisionUpdate += PhysicsCollision; + pa.SubscribeEvents(50); // 20 reports per second + } + else + { + pa.UnSubscribeEvents(); + } + } + + public void aggregateScriptEvents() { if (ParentGroup == null || ParentGroup.RootPart == null) @@ -4740,7 +4807,7 @@ namespace OpenSim.Region.Framework.Scenes { objectflagupdate |= (uint) PrimFlags.AllowInventoryDrop; } - +/* PhysicsActor pa = PhysActor; if (pa != null) { @@ -4751,7 +4818,7 @@ namespace OpenSim.Region.Framework.Scenes // ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) || // ((AggregateScriptEvents & scriptEvents.land_collision) != 0) || // ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) || - ((AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhyscicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) + ((AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || ((ParentGroup.RootPart.AggregateScriptEvents & PhysicsNeededSubsEvents) != 0) || (CollisionSound != UUID.Zero) ) { // subscribe to physics updates. @@ -4764,6 +4831,9 @@ namespace OpenSim.Region.Framework.Scenes pa.OnCollisionUpdate -= PhysicsCollision; } } + */ + UpdatePhysicsSubscribedEvents(); + //if ((GetEffectiveObjectFlags() & (uint)PrimFlags.Scripted) != 0) //{ // ParentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; From accab1e086b8a77b233371b07b648195355d6603 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 15 May 2012 16:56:43 +0100 Subject: [PATCH 8/9] sop colisions don't play sounds on volume detectors --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 11d6b57b4b..3850e46b70 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2652,7 +2652,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastColliders.Remove(localID); } // play the sound. - if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f) + if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && !ParentGroup.RootPart.VolumeDetectActive) SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); From 81d7844f5196aeee7a02c924448795820dbf5e8b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 15 May 2012 17:01:00 +0100 Subject: [PATCH 9/9] use part VolumeDetectActive and not rootPart.VolumeDetectActive to be coerent with other places in case of future changes. Should be equivalent if all is well. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3850e46b70..8716e2075d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2652,11 +2652,14 @@ namespace OpenSim.Region.Framework.Scenes m_lastColliders.Remove(localID); } // play the sound. - if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && !ParentGroup.RootPart.VolumeDetectActive) + + bool IsNotVolumeDtc = !VolumeDetectActive; + + if (startedColliders.Count > 0 && CollisionSound != UUID.Zero && CollisionSoundVolume > 0.0f && IsNotVolumeDtc) SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0, 0, false, false); SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); - if(!ParentGroup.RootPart.VolumeDetectActive) + if (IsNotVolumeDtc) SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd);