aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-01-24 18:46:24 +0000
committerJustin Clark-Casey (justincc)2012-01-24 18:46:24 +0000
commit8b035dc3c7ec88ec2c715ebaad9c3de5a34078b5 (patch)
tree51b15faa32fc0bc33f3f7461625d560887037b2c
parentRevert "Change linux, windows and mac ODE libraries to use the GIMPACT collid... (diff)
downloadopensim-SC-8b035dc3c7ec88ec2c715ebaad9c3de5a34078b5.zip
opensim-SC-8b035dc3c7ec88ec2c715ebaad9c3de5a34078b5.tar.gz
opensim-SC-8b035dc3c7ec88ec2c715ebaad9c3de5a34078b5.tar.bz2
opensim-SC-8b035dc3c7ec88ec2c715ebaad9c3de5a34078b5.tar.xz
Restrict accessible of ODECharacter Shell and Body. Add method doc and some error log lines.
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs37
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs2
2 files changed, 27 insertions, 12 deletions
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
134 | CollisionCategories.Body 134 | CollisionCategories.Body
135 | CollisionCategories.Character 135 | CollisionCategories.Character
136 | CollisionCategories.Land); 136 | CollisionCategories.Land);
137 internal IntPtr Body = IntPtr.Zero; 137 /// <summary>
138 /// Body for dynamics simulation
139 /// </summary>
140 internal IntPtr Body { get; private set; }
141
138 private OdeScene _parent_scene; 142 private OdeScene _parent_scene;
139 internal IntPtr Shell = IntPtr.Zero; 143
144 /// <summary>
145 /// Collision geometry
146 /// </summary>
147 internal IntPtr Shell { get; private set; }
148
140 private IntPtr Amotor = IntPtr.Zero; 149 private IntPtr Amotor = IntPtr.Zero;
141 private d.Mass ShellMass; 150 private d.Mass ShellMass;
142 151
@@ -1018,6 +1027,13 @@ namespace OpenSim.Region.Physics.OdePlugin
1018 /// <param name="tensor"></param> 1027 /// <param name="tensor"></param>
1019 private void CreateOdeStructures(float npositionX, float npositionY, float npositionZ, float tensor) 1028 private void CreateOdeStructures(float npositionX, float npositionY, float npositionZ, float tensor)
1020 { 1029 {
1030 if (!(Shell == IntPtr.Zero && Body == IntPtr.Zero && Amotor == IntPtr.Zero))
1031 {
1032 m_log.ErrorFormat(
1033 "[ODE CHARACTER]: Creating ODE structures for {0} even though some already exist. Shell = {1}, Body = {2}, Amotor = {3}",
1034 Name, Shell, Body, Amotor);
1035 }
1036
1021 int dAMotorEuler = 1; 1037 int dAMotorEuler = 1;
1022// _parent_scene.waitForSpaceUnlock(_parent_scene.space); 1038// _parent_scene.waitForSpaceUnlock(_parent_scene.space);
1023 if (CAPSULE_LENGTH <= 0) 1039 if (CAPSULE_LENGTH <= 0)
@@ -1135,6 +1151,14 @@ namespace OpenSim.Region.Physics.OdePlugin
1135 /// </summary> 1151 /// </summary>
1136 internal void DestroyOdeStructures() 1152 internal void DestroyOdeStructures()
1137 { 1153 {
1154 // Create avatar capsule and related ODE data
1155 if (Shell == IntPtr.Zero || Body == IntPtr.Zero || Amotor == IntPtr.Zero)
1156 {
1157 m_log.ErrorFormat(
1158 "[ODE CHARACTER]: Destroying ODE structures for {0} even though some are already null. Shell = {1}, Body = {2}, Amotor = {3}",
1159 Name, Shell, Body, Amotor);
1160 }
1161
1138 // destroy avatar capsule and related ODE data 1162 // destroy avatar capsule and related ODE data
1139 if (Amotor != IntPtr.Zero) 1163 if (Amotor != IntPtr.Zero)
1140 { 1164 {
@@ -1260,15 +1284,6 @@ namespace OpenSim.Region.Physics.OdePlugin
1260 { 1284 {
1261 if (m_tainted_isPhysical) 1285 if (m_tainted_isPhysical)
1262 { 1286 {
1263 // Create avatar capsule and related ODE data
1264 if (!(Shell == IntPtr.Zero && Body == IntPtr.Zero && Amotor == IntPtr.Zero))
1265 {
1266 m_log.Warn("[ODE CHARACTER]: re-creating the following avatar ODE data for " + Name + ", even though it already exists - "
1267 + (Shell!=IntPtr.Zero ? "Shell ":"")
1268 + (Body!=IntPtr.Zero ? "Body ":"")
1269 + (Amotor!=IntPtr.Zero ? "Amotor ":""));
1270 }
1271
1272 CreateOdeStructures(_position.X, _position.Y, _position.Z, m_tensor); 1287 CreateOdeStructures(_position.X, _position.Y, _position.Z, m_tensor);
1273 _parent_scene.AddCharacter(this); 1288 _parent_scene.AddCharacter(this);
1274 } 1289 }
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
1525 chr.CollidingGround = false; 1525 chr.CollidingGround = false;
1526 chr.CollidingObj = false; 1526 chr.CollidingObj = false;
1527 1527
1528 // test the avatar's geometry for collision with the space 1528 // Test the avatar's geometry for collision with the space
1529 // This will return near and the space that they are the closest to 1529 // This will return near and the space that they are the closest to
1530 // And we'll run this again against the avatar and the space segment 1530 // And we'll run this again against the avatar and the space segment
1531 // This will return with a bunch of possible objects in the space segment 1531 // This will return with a bunch of possible objects in the space segment