From 937c06db54f8152486d37a4ba604ffb3bcdccbb4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 15 Dec 2011 21:57:22 +0000 Subject: 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 --- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/OdePlugin/ODECharacter.cs') 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 internal IntPtr Body = IntPtr.Zero; private OdeScene _parent_scene; internal IntPtr Shell = IntPtr.Zero; - internal IntPtr Amotor = IntPtr.Zero; + private IntPtr Amotor = IntPtr.Zero; private d.Mass ShellMass; private int m_eventsubscription = 0; @@ -549,8 +549,8 @@ namespace OpenSim.Region.Physics.OdePlugin { get { - float AVvolume = (float) (Math.PI*Math.Pow(CAPSULE_RADIUS, 2)*CAPSULE_LENGTH); - return m_density*AVvolume; + float AVvolume = (float)(Math.PI * Math.Pow(CAPSULE_RADIUS, 2) * CAPSULE_LENGTH); + return m_density * AVvolume; } } -- cgit v1.1 From c0ba99e5ada0b734b932091befce69dbd53d149a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 15 Dec 2011 22:29:36 +0000 Subject: Stop having to call SetHeight again in ScenePresence.AddToPhysicalScene() when we've already passed size information to the avatar at PhysicsScene.AddAvatar() Eliminate some copypasta for height setting in OdeCharacter --- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 38 ++++++++++++++---------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/Physics/OdePlugin/ODECharacter.cs') diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 9c7e0ef..9200016 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -199,9 +199,11 @@ namespace OpenSim.Region.Physics.OdePlugin { m_colliderarr[i] = false; } - CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; - //m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH.ToString()); - m_tainted_CAPSULE_LENGTH = CAPSULE_LENGTH; + + // We can set taint and actual to be the same here, since the entire character will be set up when the + // m_tainted_isPhysical is processed. + SetTaintedCapsuleLength(size); + CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH; m_isPhysical = false; // current status: no ODE information exists m_tainted_isPhysical = true; // new tainted status: need to create ODE information @@ -457,24 +459,28 @@ namespace OpenSim.Region.Physics.OdePlugin get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); } set { - if (value.IsFinite()) - { - m_pidControllerActive = true; - - Vector3 SetSize = value; - m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; -// m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH); + SetTaintedCapsuleLength(value); // If we reset velocity here, then an avatar stalls when it crosses a border for the first time // (as the height of the new root agent is set). // Velocity = Vector3.Zero; - _parent_scene.AddPhysicsActorTaint(this); - } - else - { - m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size from Scene on {0}", Name); - } + _parent_scene.AddPhysicsActorTaint(this); + } + } + + private void SetTaintedCapsuleLength(Vector3 size) + { + if (size.IsFinite()) + { + m_pidControllerActive = true; + + m_tainted_CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; +// m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH); + } + else + { + m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.Name); } } -- cgit v1.1 From 8013c0d2f5cf964bde3bb212b5828f708ad3c816 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 15 Dec 2011 22:33:14 +0000 Subject: Stop pointlessly setting the m_colliderarr[] to false in the ODECharacter constructor --- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'OpenSim/Region/Physics/OdePlugin/ODECharacter.cs') diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 9200016..f2bb4bf 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -195,11 +195,6 @@ namespace OpenSim.Region.Physics.OdePlugin // new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f, // 0.5f); - for (int i = 0; i < 11; i++) - { - m_colliderarr[i] = false; - } - // We can set taint and actual to be the same here, since the entire character will be set up when the // m_tainted_isPhysical is processed. SetTaintedCapsuleLength(size); -- cgit v1.1