From 8b035dc3c7ec88ec2c715ebaad9c3de5a34078b5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 24 Jan 2012 18:46:24 +0000 Subject: Restrict accessible of ODECharacter Shell and Body. Add method doc and some error log lines. --- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 37 +++++++++++++++++------- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 2 +- 2 files changed, 27 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 68999fc..c6e8286 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -134,9 +134,18 @@ namespace OpenSim.Region.Physics.OdePlugin | CollisionCategories.Body | CollisionCategories.Character | CollisionCategories.Land); - internal IntPtr Body = IntPtr.Zero; + /// + /// Body for dynamics simulation + /// + internal IntPtr Body { get; private set; } + private OdeScene _parent_scene; - internal IntPtr Shell = IntPtr.Zero; + + /// + /// Collision geometry + /// + internal IntPtr Shell { get; private set; } + private IntPtr Amotor = IntPtr.Zero; private d.Mass ShellMass; @@ -1018,6 +1027,13 @@ namespace OpenSim.Region.Physics.OdePlugin /// private void CreateOdeStructures(float npositionX, float npositionY, float npositionZ, float tensor) { + if (!(Shell == IntPtr.Zero && Body == IntPtr.Zero && Amotor == IntPtr.Zero)) + { + m_log.ErrorFormat( + "[ODE CHARACTER]: Creating ODE structures for {0} even though some already exist. Shell = {1}, Body = {2}, Amotor = {3}", + Name, Shell, Body, Amotor); + } + int dAMotorEuler = 1; // _parent_scene.waitForSpaceUnlock(_parent_scene.space); if (CAPSULE_LENGTH <= 0) @@ -1135,6 +1151,14 @@ namespace OpenSim.Region.Physics.OdePlugin /// internal void DestroyOdeStructures() { + // Create avatar capsule and related ODE data + if (Shell == IntPtr.Zero || Body == IntPtr.Zero || Amotor == IntPtr.Zero) + { + m_log.ErrorFormat( + "[ODE CHARACTER]: Destroying ODE structures for {0} even though some are already null. Shell = {1}, Body = {2}, Amotor = {3}", + Name, Shell, Body, Amotor); + } + // destroy avatar capsule and related ODE data if (Amotor != IntPtr.Zero) { @@ -1260,15 +1284,6 @@ namespace OpenSim.Region.Physics.OdePlugin { if (m_tainted_isPhysical) { - // Create avatar capsule and related ODE data - if (!(Shell == IntPtr.Zero && Body == IntPtr.Zero && Amotor == IntPtr.Zero)) - { - m_log.Warn("[ODE CHARACTER]: re-creating the following avatar ODE data for " + Name + ", even though it already exists - " - + (Shell!=IntPtr.Zero ? "Shell ":"") - + (Body!=IntPtr.Zero ? "Body ":"") - + (Amotor!=IntPtr.Zero ? "Amotor ":"")); - } - CreateOdeStructures(_position.X, _position.Y, _position.Z, m_tensor); _parent_scene.AddCharacter(this); } diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 228eca9..37daf46 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -1525,7 +1525,7 @@ namespace OpenSim.Region.Physics.OdePlugin chr.CollidingGround = false; chr.CollidingObj = false; - // test the avatar's geometry for collision with the space + // Test the avatar's geometry for collision with the space // This will return near and the space that they are the closest to // And we'll run this again against the avatar and the space segment // This will return with a bunch of possible objects in the space segment -- cgit v1.1