aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-12-15 21:57:22 +0000
committerJustin Clark-Casey (justincc)2011-12-15 21:57:22 +0000
commit937c06db54f8152486d37a4ba604ffb3bcdccbb4 (patch)
treebb8b30c6cdac92c82352fc829ebdf0a6e663cdba /OpenSim
parentminor: add some currently commented log lines for use in debugging (diff)
downloadopensim-SC_OLD-937c06db54f8152486d37a4ba604ffb3bcdccbb4.zip
opensim-SC_OLD-937c06db54f8152486d37a4ba604ffb3bcdccbb4.tar.gz
opensim-SC_OLD-937c06db54f8152486d37a4ba604ffb3bcdccbb4.tar.bz2
opensim-SC_OLD-937c06db54f8152486d37a4ba604ffb3bcdccbb4.tar.xz
Code cleanup related to ScenePresence.PhysicsActor and OdeScene/OdeCharacter
Stop hiding RemoveAvatar failure, add log messages when characters are removed through defects or re-added unexpectedly. Add commented out log lines for future use. Use automatic property for PhysicsActor for better code readability and simplicity
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs59
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs6
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs26
3 files changed, 56 insertions, 35 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index beff239..6f5b6fe 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -285,16 +285,10 @@ namespace OpenSim.Region.Framework.Scenes
285 285
286 #region Properties 286 #region Properties
287 287
288 protected PhysicsActor m_physicsActor;
289
290 /// <summary> 288 /// <summary>
291 /// Physical scene representation of this Avatar. 289 /// Physical scene representation of this Avatar.
292 /// </summary> 290 /// </summary>
293 public PhysicsActor PhysicsActor 291 public PhysicsActor PhysicsActor { get; private set; }
294 {
295 set { m_physicsActor = value; }
296 get { return m_physicsActor; }
297 }
298 292
299 private byte m_movementflag; 293 private byte m_movementflag;
300 294
@@ -1032,18 +1026,19 @@ namespace OpenSim.Region.Framework.Scenes
1032 { 1026 {
1033 if (PhysicsActor != null) 1027 if (PhysicsActor != null)
1034 { 1028 {
1035 try 1029// PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
1036 { 1030 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall;
1037 PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 1031 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
1038 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; 1032 PhysicsActor.UnSubscribeEvents();
1039 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); 1033 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1040 PhysicsActor.UnSubscribeEvents(); 1034 PhysicsActor = null;
1041 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1042 PhysicsActor = null;
1043 }
1044 catch
1045 { }
1046 } 1035 }
1036// else
1037// {
1038// m_log.ErrorFormat(
1039// "[SCENE PRESENCE]: Attempt to remove physics actor for {0} on {1} but this scene presence has no physics actor",
1040// Name, Scene.RegionInfo.RegionName);
1041// }
1047 } 1042 }
1048 1043
1049 /// <summary> 1044 /// <summary>
@@ -1925,7 +1920,7 @@ namespace OpenSim.Region.Framework.Scenes
1925// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); 1920// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied);
1926 1921
1927 if (PhysicsActor != null) 1922 if (PhysicsActor != null)
1928 m_sitAvatarHeight = m_physicsActor.Size.Z; 1923 m_sitAvatarHeight = PhysicsActor.Size.Z;
1929 1924
1930 bool canSit = false; 1925 bool canSit = false;
1931 pos = part.AbsolutePosition + offset; 1926 pos = part.AbsolutePosition + offset;
@@ -2570,7 +2565,10 @@ namespace OpenSim.Region.Framework.Scenes
2570 // only send update from root agents to other clients; children are only "listening posts" 2565 // only send update from root agents to other clients; children are only "listening posts"
2571 if (IsChildAgent) 2566 if (IsChildAgent)
2572 { 2567 {
2573 m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent"); 2568 m_log.WarnFormat(
2569 "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}",
2570 Name, Scene.RegionInfo.RegionName);
2571
2574 return; 2572 return;
2575 } 2573 }
2576 2574
@@ -2628,7 +2626,10 @@ namespace OpenSim.Region.Framework.Scenes
2628 // only send update from root agents to other clients; children are only "listening posts" 2626 // only send update from root agents to other clients; children are only "listening posts"
2629 if (IsChildAgent) 2627 if (IsChildAgent)
2630 { 2628 {
2631 m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent"); 2629 m_log.WarnFormat(
2630 "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}",
2631 Name, Scene.RegionInfo.RegionName);
2632
2632 return; 2633 return;
2633 } 2634 }
2634 2635
@@ -3039,8 +3040,6 @@ namespace OpenSim.Region.Framework.Scenes
3039 3040
3040 CameraPosition = cAgentData.Center + offset; 3041 CameraPosition = cAgentData.Center + offset;
3041 3042
3042 //SetHeight(cAgentData.AVHeight);
3043
3044 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) 3043 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
3045 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); 3044 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
3046 3045
@@ -3251,6 +3250,13 @@ namespace OpenSim.Region.Framework.Scenes
3251// "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", 3250// "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}",
3252// Name, isFlying, Scene.RegionInfo.RegionName); 3251// Name, isFlying, Scene.RegionInfo.RegionName);
3253 3252
3253 if (PhysicsActor != null)
3254 {
3255 m_log.ErrorFormat(
3256 "[SCENE PRESENCE]: Adding physics actor for {0} to {1} but this scene presence already has a physics actor",
3257 Name, Scene.RegionInfo.RegionName);
3258 }
3259
3254 if (Appearance.AvatarHeight == 0) 3260 if (Appearance.AvatarHeight == 0)
3255 Appearance.SetHeight(); 3261 Appearance.SetHeight();
3256 3262
@@ -3258,11 +3264,10 @@ namespace OpenSim.Region.Framework.Scenes
3258 3264
3259 Vector3 pVec = AbsolutePosition; 3265 Vector3 pVec = AbsolutePosition;
3260 3266
3261 // Old bug where the height was in centimeters instead of meters 3267 PhysicsActor = scene.AddAvatar(
3262 PhysicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, 3268 LocalId, Firstname + "." + Lastname, pVec,
3263 new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying); 3269 new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying);
3264 3270
3265 scene.AddPhysicsActorTaint(PhysicsActor);
3266 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 3271 //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3267 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 3272 PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3268 PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong 3273 PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 73c1c02..9c7e0ef 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Physics.OdePlugin
137 internal IntPtr Body = IntPtr.Zero; 137 internal IntPtr Body = IntPtr.Zero;
138 private OdeScene _parent_scene; 138 private OdeScene _parent_scene;
139 internal IntPtr Shell = IntPtr.Zero; 139 internal IntPtr Shell = IntPtr.Zero;
140 internal IntPtr Amotor = IntPtr.Zero; 140 private IntPtr Amotor = IntPtr.Zero;
141 private d.Mass ShellMass; 141 private d.Mass ShellMass;
142 142
143 private int m_eventsubscription = 0; 143 private int m_eventsubscription = 0;
@@ -549,8 +549,8 @@ namespace OpenSim.Region.Physics.OdePlugin
549 { 549 {
550 get 550 get
551 { 551 {
552 float AVvolume = (float) (Math.PI*Math.Pow(CAPSULE_RADIUS, 2)*CAPSULE_LENGTH); 552 float AVvolume = (float)(Math.PI * Math.Pow(CAPSULE_RADIUS, 2) * CAPSULE_LENGTH);
553 return m_density*AVvolume; 553 return m_density * AVvolume;
554 } 554 }
555 } 555 }
556 556
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index da540fa..afe646c 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -1703,7 +1703,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1703// "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2}", 1703// "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2}",
1704// actor.Name, actor.LocalID, Name); 1704// actor.Name, actor.LocalID, Name);
1705 1705
1706 //m_log.Debug("[PHYSICS]:ODELOCK");
1707 ((OdeCharacter) actor).Destroy(); 1706 ((OdeCharacter) actor).Destroy();
1708 } 1707 }
1709 1708
@@ -1711,11 +1710,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1711 { 1710 {
1712 if (!_characters.Contains(chr)) 1711 if (!_characters.Contains(chr))
1713 { 1712 {
1714// m_log.DebugFormat(
1715// "[ODE SCENE]: Adding physics character {0} {1} to physics scene {2}", chr.Name, chr.LocalID, Name);
1716
1717 _characters.Add(chr); 1713 _characters.Add(chr);
1718 1714
1715// m_log.DebugFormat(
1716// "[ODE SCENE]: Adding physics character {0} {1} to physics scene {2}. Count now {3}",
1717// chr.Name, chr.LocalID, Name, _characters.Count);
1718
1719 if (chr.bad) 1719 if (chr.bad)
1720 m_log.ErrorFormat("[ODE SCENE]: Added BAD actor {0} to characters list", chr.m_uuid); 1720 m_log.ErrorFormat("[ODE SCENE]: Added BAD actor {0} to characters list", chr.m_uuid);
1721 } 1721 }
@@ -1730,11 +1730,19 @@ namespace OpenSim.Region.Physics.OdePlugin
1730 internal void RemoveCharacter(OdeCharacter chr) 1730 internal void RemoveCharacter(OdeCharacter chr)
1731 { 1731 {
1732 if (_characters.Contains(chr)) 1732 if (_characters.Contains(chr))
1733 {
1733 _characters.Remove(chr); 1734 _characters.Remove(chr);
1735
1736// m_log.DebugFormat(
1737// "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2}. Count now {3}",
1738// chr.Name, chr.LocalID, Name, _characters.Count);
1739 }
1734 else 1740 else
1741 {
1735 m_log.ErrorFormat( 1742 m_log.ErrorFormat(
1736 "[ODE SCENE]: Tried to remove character {0} {1} but they are not in the list!", 1743 "[ODE SCENE]: Tried to remove character {0} {1} but they are not in the list!",
1737 chr.Name, chr.LocalID); 1744 chr.Name, chr.LocalID);
1745 }
1738 } 1746 }
1739 1747
1740 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, 1748 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
@@ -1772,7 +1780,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1772 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 1780 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
1773 Vector3 size, Quaternion rotation, bool isPhysical, uint localid) 1781 Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
1774 { 1782 {
1775// m_log.DebugFormat("[ODE SCENE]: Adding physics prim {0} {1} to physics scene {2}", primName, localid, Name); 1783 m_log.DebugFormat("[ODE SCENE]: Adding physics prim {0} {1} to physics scene {2}", primName, localid, Name);
1776 1784
1777 return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid); 1785 return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid);
1778 } 1786 }
@@ -2762,6 +2770,10 @@ namespace OpenSim.Region.Physics.OdePlugin
2762 { 2770 {
2763 foreach (OdeCharacter actor in defects) 2771 foreach (OdeCharacter actor in defects)
2764 { 2772 {
2773 m_log.ErrorFormat(
2774 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when moving",
2775 actor.Name, actor.LocalID, Name);
2776
2765 RemoveCharacter(actor); 2777 RemoveCharacter(actor);
2766 actor.DestroyOdeStructures(); 2778 actor.DestroyOdeStructures();
2767 } 2779 }
@@ -2832,6 +2844,10 @@ namespace OpenSim.Region.Physics.OdePlugin
2832 { 2844 {
2833 foreach (OdeCharacter actor in defects) 2845 foreach (OdeCharacter actor in defects)
2834 { 2846 {
2847 m_log.ErrorFormat(
2848 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when updating position and velocity",
2849 actor.Name, actor.LocalID, Name);
2850
2835 RemoveCharacter(actor); 2851 RemoveCharacter(actor);
2836 actor.DestroyOdeStructures(); 2852 actor.DestroyOdeStructures();
2837 } 2853 }