From 6b9d58b99b2e9b53bb6659de342a628f73df7ae8 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 1 Mar 2011 12:42:05 -0800 Subject: [PATCH] Make PECharacter sync PhysActor info back to physics actor. Remove some chatty debug messages. Add checks to warn if PhysicsActor synchronization is acting on a prim rather than a character. --- .../PhysEngineToSceneConnector.cs | 10 ++++++- .../SceneToPhysEngineConnector.cs | 8 ++++++ .../Region/Framework/Scenes/ScenePresence.cs | 4 +-- .../Region/Physics/PEPlugin/PECharacter.cs | 27 +++++++++++++++++-- OpenSim/Region/Physics/PEPlugin/PEPrim.cs | 6 ++--- 5 files changed, 47 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/PhysEngineToSceneConnector.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/PhysEngineToSceneConnector.cs index 62bdcf6efc..543d17a055 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/PhysEngineToSceneConnector.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/PhysEngineToSceneConnector.cs @@ -379,10 +379,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { UUID uuid = data["uuid"].AsUUID(); string actorID = data["actorID"].AsString(); - // m_log.DebugFormat("{0}: HandlPhysUpdateAttributes for {1}", LogHeader, uuid); + m_log.DebugFormat("{0}: HandlPhysUpdateAttributes for {1}", LogHeader, uuid); PhysicsActor pa = FindPhysicsActor(uuid); if (pa != null) { + if (pa.PhysicsActorType == (int)ActorTypes.Prim) + { + m_log.WarnFormat("{0}: HandlePhysUpdateAttributes for an prim: {1}", LogHeader, pa.UUID); + } // pa.Size = data["size"].AsVector3(); pa.Position = data["position"].AsVector3(); pa.Force = data["force"].AsVector3(); @@ -436,6 +440,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public void SendPhysUpdateAttributes(PhysicsActor pa) { // m_log.DebugFormat("{0}: SendPhysUpdateAttributes for {1}", LogHeader, pa.UUID); + if (pa.PhysicsActorType == (int)ActorTypes.Prim) + { + m_log.WarnFormat("{0}: SendPhysUpdateAttributes for an prim: {1}", LogHeader, pa.UUID); + } OSDMap data = new OSDMap(17); data["time"] = OSD.FromString(DateTime.Now.ToString("yyyyMMddHHmmssfff")); data["localID"] = OSD.FromUInteger(pa.LocalID); diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SceneToPhysEngineConnector.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SceneToPhysEngineConnector.cs index ea3601d98d..c2e0c0cf8f 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SceneToPhysEngineConnector.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SceneToPhysEngineConnector.cs @@ -346,6 +346,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule PhysicsActor pa = FindPhysicsActor(uuid); if (pa != null) { + if (pa.PhysicsActorType == (int)ActorTypes.Prim) + { + m_log.WarnFormat("{0}: HandlePhysUpdateAttributes for an prim: {1}", LogHeader, pa.UUID); + } pa.Size = data["size"].AsVector3(); pa.Position = data["position"].AsVector3(); pa.Force = data["force"].AsVector3(); @@ -397,6 +401,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public void SendPhysUpdateAttributes(PhysicsActor pa) { // m_log.DebugFormat("{0}: sending PhysUpdateAttributes for {1}", LogHeader, pa.UUID); + if (pa.PhysicsActorType == (int)ActorTypes.Prim) + { + m_log.WarnFormat("{0}: SendPhysUpdateAttributes for an prim: {1}", LogHeader, pa.UUID); + } OSDMap data = new OSDMap(15); data["time"] = OSD.FromString(DateTime.Now.ToString("yyyyMMddHHmmssfff")); data["localID"] = OSD.FromUInteger(pa.LocalID); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 387b560965..5e6f3d2636 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1643,7 +1643,7 @@ namespace OpenSim.Region.Framework.Scenes { // m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed)); // m_log.DebugFormat( - // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); + // "[SCENE PRESENCE] In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); AddNewMovement(agent_control_v3, q); @@ -2443,7 +2443,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void SendTerseUpdateToAllClients() { - m_log.DebugFormat("[SCENE PRESENCE]: TerseUpdate: UUID={0}, pos={1}", m_physicsActor.UUID.ToString(), m_physicsActor.Position.ToString()); + // m_log.DebugFormat("[SCENE PRESENCE]: TerseUpdate: UUID={0}, pos={1}", m_physicsActor.UUID.ToString(), m_physicsActor.Position.ToString()); // REGION SYNC if (m_scene.IsSyncedServer()) { diff --git a/OpenSim/Region/Physics/PEPlugin/PECharacter.cs b/OpenSim/Region/Physics/PEPlugin/PECharacter.cs index b807e08613..8261681ec2 100755 --- a/OpenSim/Region/Physics/PEPlugin/PECharacter.cs +++ b/OpenSim/Region/Physics/PEPlugin/PECharacter.cs @@ -30,6 +30,7 @@ using log4net; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Physics.Manager; +using OpenSim.Region.CoreModules.RegionSync.RegionSyncModule; namespace OpenSim.Region.Physics.PEPlugin { @@ -86,6 +87,24 @@ public class PECharacter : PhysicsActor return; } + public override void RequestPhysicsterseUpdate() + { + if (PhysEngineToSceneConnectorModule.IsPhysEngineActorS) + { + // if the values have changed and it was I who changed them, send an update + if (this.lastValues.Changed(this) && ChangingActorID == RegionSyncServerModule.ActorID) + { + // m_log.DebugFormat("[ODE CHARACTER]: Sending terse update for {0}", LocalID); + PhysEngineToSceneConnectorModule.RouteUpdate(this); + } + } + else + { + base.RequestPhysicsterseUpdate(); + } + } + + public override bool Stopped { get { return _stopped; } } @@ -105,12 +124,12 @@ public class PECharacter : PhysicsActor } public override bool Grabbed { set { _grabbed = value; - m_log.Debug("[RPE] PEChar set Grabbed"); + // m_log.Debug("[RPE] PEChar set Grabbed"); } } public override bool Selected { set { _selected = value; - m_log.Debug("[RPE] PEChar set Selected"); + // m_log.Debug("[RPE] PEChar set Selected"); } } public override void CrossingFailure() { return; } @@ -121,6 +140,7 @@ public class PECharacter : PhysicsActor public override Vector3 Position { get { return _position; } set { _position = value; + base.ChangingActorID = RegionSyncServerModule.ActorID; } } public override float Mass { @@ -133,6 +153,7 @@ public class PECharacter : PhysicsActor public override Vector3 Force { get { return _force; } set { _force = value; + base.ChangingActorID = RegionSyncServerModule.ActorID; } } @@ -153,6 +174,7 @@ public class PECharacter : PhysicsActor public override Vector3 Velocity { get { return _velocity; } set { _velocity = value; + base.ChangingActorID = RegionSyncServerModule.ActorID; } } public override Vector3 Torque { @@ -171,6 +193,7 @@ public class PECharacter : PhysicsActor public override Quaternion Orientation { get { return _orientation; } set { _orientation = value; + base.ChangingActorID = RegionSyncServerModule.ActorID; } } public override int PhysicsActorType { diff --git a/OpenSim/Region/Physics/PEPlugin/PEPrim.cs b/OpenSim/Region/Physics/PEPlugin/PEPrim.cs index 6e3359ad82..ee70275130 100755 --- a/OpenSim/Region/Physics/PEPlugin/PEPrim.cs +++ b/OpenSim/Region/Physics/PEPlugin/PEPrim.cs @@ -96,7 +96,7 @@ public sealed class PEPrim : PhysicsActor } public override PrimitiveBaseShape Shape { set { _pbs = value; - m_log.Debug("[REMOTE PRIM ENGINE] PEPrim set Shape"); + // m_log.Debug("[REMOTE PRIM ENGINE] PEPrim set Shape"); // SyncUpdated = true; } } @@ -109,12 +109,12 @@ public sealed class PEPrim : PhysicsActor } public override bool Grabbed { set { _grabbed = value; - m_log.Debug("[REMOTE PRIM ENGINE] PEPrim set Grabbed"); + // m_log.Debug("[REMOTE PRIM ENGINE] PEPrim set Grabbed"); } } public override bool Selected { set { _selected = value; - m_log.Debug("[REMOTE PRIM ENGINE] PEPrim set Selected"); + // m_log.Debug("[REMOTE PRIM ENGINE] PEPrim set Selected"); } } public override void CrossingFailure() { return; }