aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs200
1 files changed, 100 insertions, 100 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index bf9d5d8..9a4b1b0 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -52,10 +52,10 @@ namespace OpenSim.Region.Physics.OdePlugin
52 /// </summary> 52 /// </summary>
53 public class OdePlugin : IPhysicsPlugin 53 public class OdePlugin : IPhysicsPlugin
54 { 54 {
55 //protected static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 55 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
56 56
57 protected CollisionLocker ode; 57 private CollisionLocker ode;
58 protected OdeScene _mScene; 58 private OdeScene _mScene;
59 59
60 public OdePlugin() 60 public OdePlugin()
61 { 61 {
@@ -124,62 +124,62 @@ namespace OpenSim.Region.Physics.OdePlugin
124 124
125 public class OdeScene : PhysicsScene 125 public class OdeScene : PhysicsScene
126 { 126 {
127 protected ILog m_log; 127 private ILog m_log;
128 // protected Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); 128 // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>();
129 129
130 protected CollisionLocker ode; 130 CollisionLocker ode;
131 131
132 protected Random fluidRandomizer = new Random(Environment.TickCount); 132 protected Random fluidRandomizer = new Random(Environment.TickCount);
133 133
134 protected const uint m_regionWidth = Constants.RegionSize; 134 private const uint m_regionWidth = Constants.RegionSize;
135 protected const uint m_regionHeight = Constants.RegionSize; 135 private const uint m_regionHeight = Constants.RegionSize;
136 136
137 protected float ODE_STEPSIZE = 0.020f; 137 private float ODE_STEPSIZE = 0.020f;
138 protected float metersInSpace = 29.9f; 138 private float metersInSpace = 29.9f;
139 139
140 public float gravityx = 0f; 140 public float gravityx = 0f;
141 public float gravityy = 0f; 141 public float gravityy = 0f;
142 public float gravityz = -9.8f; 142 public float gravityz = -9.8f;
143 143
144 protected float contactsurfacelayer = 0.001f; 144 private float contactsurfacelayer = 0.001f;
145 145
146 protected int worldHashspaceLow = -4; 146 private int worldHashspaceLow = -4;
147 protected int worldHashspaceHigh = 128; 147 private int worldHashspaceHigh = 128;
148 148
149 protected int smallHashspaceLow = -4; 149 private int smallHashspaceLow = -4;
150 protected int smallHashspaceHigh = 66; 150 private int smallHashspaceHigh = 66;
151 151
152 protected float waterlevel = 0f; 152 private float waterlevel = 0f;
153 protected int framecount = 0; 153 private int framecount = 0;
154 //protected int m_returncollisions = 10; 154 //private int m_returncollisions = 10;
155 155
156 protected IntPtr contactgroup; 156 private IntPtr contactgroup;
157 protected IntPtr LandGeom; 157 private IntPtr LandGeom;
158 158
159 protected IntPtr WaterGeom; 159 private IntPtr WaterGeom;
160 160
161 protected float nmTerrainContactFriction = 255.0f; 161 private float nmTerrainContactFriction = 255.0f;
162 protected float nmTerrainContactBounce = 0.1f; 162 private float nmTerrainContactBounce = 0.1f;
163 protected float nmTerrainContactERP = 0.1025f; 163 private float nmTerrainContactERP = 0.1025f;
164 164
165 protected float mTerrainContactFriction = 75f; 165 private float mTerrainContactFriction = 75f;
166 protected float mTerrainContactBounce = 0.1f; 166 private float mTerrainContactBounce = 0.1f;
167 protected float mTerrainContactERP = 0.05025f; 167 private float mTerrainContactERP = 0.05025f;
168 168
169 protected float nmAvatarObjectContactFriction = 250f; 169 private float nmAvatarObjectContactFriction = 250f;
170 protected float nmAvatarObjectContactBounce = 0.1f; 170 private float nmAvatarObjectContactBounce = 0.1f;
171 171
172 protected float mAvatarObjectContactFriction = 75f; 172 private float mAvatarObjectContactFriction = 75f;
173 protected float mAvatarObjectContactBounce = 0.1f; 173 private float mAvatarObjectContactBounce = 0.1f;
174 174
175 protected float avPIDD = 3200f; 175 private float avPIDD = 3200f;
176 protected float avPIDP = 1400f; 176 private float avPIDP = 1400f;
177 protected float avCapRadius = 0.37f; 177 private float avCapRadius = 0.37f;
178 protected float avStandupTensor = 2000000f; 178 private float avStandupTensor = 2000000f;
179 protected float avDensity = 80f; 179 private float avDensity = 80f;
180 protected float avHeightFudgeFactor = 0.52f; 180 private float avHeightFudgeFactor = 0.52f;
181 protected float avMovementDivisorWalk = 1.3f; 181 private float avMovementDivisorWalk = 1.3f;
182 protected float avMovementDivisorRun = 0.8f; 182 private float avMovementDivisorRun = 0.8f;
183 183
184 public bool meshSculptedPrim = true; 184 public bool meshSculptedPrim = true;
185 185
@@ -200,66 +200,66 @@ namespace OpenSim.Region.Physics.OdePlugin
200 200
201 public int bodyFramesAutoDisable = 20; 201 public int bodyFramesAutoDisable = 20;
202 202
203 protected float[] _heightmap; 203 private float[] _heightmap;
204 204
205 protected float[] _watermap; 205 private float[] _watermap;
206 protected bool m_filterCollisions = true; 206 private bool m_filterCollisions = true;
207 207
208 // protected float[] _origheightmap; 208 // private float[] _origheightmap;
209 209
210 protected d.NearCallback nearCallback; 210 private d.NearCallback nearCallback;
211 public d.TriCallback triCallback; 211 public d.TriCallback triCallback;
212 public d.TriArrayCallback triArrayCallback; 212 public d.TriArrayCallback triArrayCallback;
213 protected List<OdeCharacter> _characters = new List<OdeCharacter>(); 213 private List<OdeCharacter> _characters = new List<OdeCharacter>();
214 protected List<OdePrim> _prims = new List<OdePrim>(); 214 private List<OdePrim> _prims = new List<OdePrim>();
215 protected List<OdePrim> _activeprims = new List<OdePrim>(); 215 private List<OdePrim> _activeprims = new List<OdePrim>();
216 protected List<OdePrim> _taintedPrim = new List<OdePrim>(); 216 private List<OdePrim> _taintedPrim = new List<OdePrim>();
217 protected List<OdeCharacter> _taintedActors = new List<OdeCharacter>(); 217 private List<OdeCharacter> _taintedActors = new List<OdeCharacter>();
218 protected List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>(); 218 private List<d.ContactGeom> _perloopContact = new List<d.ContactGeom>();
219 protected List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>(); 219 private List<PhysicsActor> _collisionEventPrim = new List<PhysicsActor>();
220 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); 220 public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
221 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); 221 public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
222 protected bool m_NINJA_physics_joints_enabled = false; 222 private bool m_NINJA_physics_joints_enabled = false;
223 //protected Dictionary<String, IntPtr> jointpart_name_map = new Dictionary<String,IntPtr>(); 223 //private Dictionary<String, IntPtr> jointpart_name_map = new Dictionary<String,IntPtr>();
224 protected Dictionary<String, List<PhysicsJoint>> joints_connecting_actor = new Dictionary<String, List<PhysicsJoint>>(); 224 private Dictionary<String, List<PhysicsJoint>> joints_connecting_actor = new Dictionary<String, List<PhysicsJoint>>();
225 protected d.ContactGeom[] contacts = new d.ContactGeom[80]; 225 private d.ContactGeom[] contacts = new d.ContactGeom[80];
226 protected List<PhysicsJoint> requestedJointsToBeCreated = new List<PhysicsJoint>(); // lock only briefly. accessed by external code (to request new joints) and by OdeScene.Simulate() to move those joints into pending/active 226 private List<PhysicsJoint> requestedJointsToBeCreated = new List<PhysicsJoint>(); // lock only briefly. accessed by external code (to request new joints) and by OdeScene.Simulate() to move those joints into pending/active
227 protected List<PhysicsJoint> pendingJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene. 227 private List<PhysicsJoint> pendingJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene.
228 protected List<PhysicsJoint> activeJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene. 228 private List<PhysicsJoint> activeJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene.
229 protected List<string> requestedJointsToBeDeleted = new List<string>(); // lock only briefly. accessed by external code (to request deletion of joints) and by OdeScene.Simulate() to move those joints out of pending/active 229 private List<string> requestedJointsToBeDeleted = new List<string>(); // lock only briefly. accessed by external code (to request deletion of joints) and by OdeScene.Simulate() to move those joints out of pending/active
230 protected Object externalJointRequestsLock = new Object(); 230 private Object externalJointRequestsLock = new Object();
231 protected Dictionary<String, PhysicsJoint> SOPName_to_activeJoint = new Dictionary<String, PhysicsJoint>(); 231 private Dictionary<String, PhysicsJoint> SOPName_to_activeJoint = new Dictionary<String, PhysicsJoint>();
232 protected Dictionary<String, PhysicsJoint> SOPName_to_pendingJoint = new Dictionary<String, PhysicsJoint>(); 232 private Dictionary<String, PhysicsJoint> SOPName_to_pendingJoint = new Dictionary<String, PhysicsJoint>();
233 233
234 protected d.Contact contact; 234 private d.Contact contact;
235 protected d.Contact TerrainContact; 235 private d.Contact TerrainContact;
236 protected d.Contact AvatarMovementprimContact; 236 private d.Contact AvatarMovementprimContact;
237 protected d.Contact AvatarMovementTerrainContact; 237 private d.Contact AvatarMovementTerrainContact;
238 protected d.Contact WaterContact; 238 private d.Contact WaterContact;
239 239
240//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it 240//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it
241//Ckrinke protected int m_randomizeWater = 200; 241//Ckrinke private int m_randomizeWater = 200;
242 protected int m_physicsiterations = 10; 242 private int m_physicsiterations = 10;
243 protected float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag 243 private float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag
244 protected PhysicsActor PANull = new NullPhysicsActor(); 244 private PhysicsActor PANull = new NullPhysicsActor();
245 protected float step_time = 0.0f; 245 private float step_time = 0.0f;
246//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it 246//Ckrinke: Comment out until used. We declare it, initialize it, but do not use it
247//Ckrinke protected int ms = 0; 247//Ckrinke private int ms = 0;
248 public IntPtr world; 248 public IntPtr world;
249 //protected bool returncollisions = false; 249 //private bool returncollisions = false;
250 // protected uint obj1LocalID = 0; 250 // private uint obj1LocalID = 0;
251 protected uint obj2LocalID = 0; 251 private uint obj2LocalID = 0;
252 //protected int ctype = 0; 252 //private int ctype = 0;
253 protected OdeCharacter cc1; 253 private OdeCharacter cc1;
254 protected OdePrim cp1; 254 private OdePrim cp1;
255 protected OdeCharacter cc2; 255 private OdeCharacter cc2;
256 protected OdePrim cp2; 256 private OdePrim cp2;
257 //protected int cStartStop = 0; 257 //private int cStartStop = 0;
258 //protected string cDictKey = ""; 258 //private string cDictKey = "";
259 259
260 public IntPtr space; 260 public IntPtr space;
261 261
262 //protected IntPtr tmpSpace; 262 //private IntPtr tmpSpace;
263 // split static geometry collision handling into spaces of 30 meters 263 // split static geometry collision handling into spaces of 30 meters
264 public IntPtr[,] staticPrimspace; 264 public IntPtr[,] staticPrimspace;
265 265
@@ -267,7 +267,7 @@ namespace OpenSim.Region.Physics.OdePlugin
267 267
268 public IMesher mesher; 268 public IMesher mesher;
269 269
270 protected IConfigSource m_config; 270 private IConfigSource m_config;
271 271
272 public bool physics_logging = false; 272 public bool physics_logging = false;
273 public int physics_logging_interval = 0; 273 public int physics_logging_interval = 0;
@@ -498,7 +498,7 @@ namespace OpenSim.Region.Physics.OdePlugin
498 } 498 }
499 } 499 }
500 500
501 public void waitForSpaceUnlock(IntPtr space) 501 internal void waitForSpaceUnlock(IntPtr space)
502 { 502 {
503 //if (space != IntPtr.Zero) 503 //if (space != IntPtr.Zero)
504 //while (d.SpaceLockQuery(space)) { } // Wait and do nothing 504 //while (d.SpaceLockQuery(space)) { } // Wait and do nothing
@@ -522,7 +522,7 @@ namespace OpenSim.Region.Physics.OdePlugin
522 /// <param name="space">The space that contains the geoms. Remember, spaces are also geoms</param> 522 /// <param name="space">The space that contains the geoms. Remember, spaces are also geoms</param>
523 /// <param name="g1">a geometry or space</param> 523 /// <param name="g1">a geometry or space</param>
524 /// <param name="g2">another geometry or space</param> 524 /// <param name="g2">another geometry or space</param>
525 protected void near(IntPtr space, IntPtr g1, IntPtr g2) 525 private void near(IntPtr space, IntPtr g1, IntPtr g2)
526 { 526 {
527 // no lock here! It's invoked from within Simulate(), which is thread-locked 527 // no lock here! It's invoked from within Simulate(), which is thread-locked
528 528
@@ -949,7 +949,7 @@ namespace OpenSim.Region.Physics.OdePlugin
949 } 949 }
950 } 950 }
951 951
952 protected bool checkDupe(d.ContactGeom contactGeom, int atype) 952 private bool checkDupe(d.ContactGeom contactGeom, int atype)
953 { 953 {
954 bool result = false; 954 bool result = false;
955 //return result; 955 //return result;
@@ -1019,7 +1019,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1019 return result; 1019 return result;
1020 } 1020 }
1021 1021
1022 protected void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, float collisiondepth) 1022 private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, float collisiondepth)
1023 { 1023 {
1024 // obj1LocalID = 0; 1024 // obj1LocalID = 0;
1025 //returncollisions = false; 1025 //returncollisions = false;
@@ -1197,7 +1197,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1197 /// This is our collision testing routine in ODE 1197 /// This is our collision testing routine in ODE
1198 /// </summary> 1198 /// </summary>
1199 /// <param name="timeStep"></param> 1199 /// <param name="timeStep"></param>
1200 protected void collision_optimized(float timeStep) 1200 private void collision_optimized(float timeStep)
1201 { 1201 {
1202 _perloopContact.Clear(); 1202 _perloopContact.Clear();
1203 1203
@@ -1286,7 +1286,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1286 #endregion 1286 #endregion
1287 1287
1288// TODO: unused 1288// TODO: unused
1289// protected float GetTerrainHeightAtXY(float x, float y) 1289// private float GetTerrainHeightAtXY(float x, float y)
1290// { 1290// {
1291// return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x]; 1291// return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x];
1292// } 1292// }
@@ -1332,7 +1332,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1332 } 1332 }
1333 } 1333 }
1334 1334
1335 protected PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, 1335 private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation,
1336 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) 1336 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
1337 { 1337 {
1338 PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z); 1338 PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z);
@@ -1407,28 +1407,28 @@ namespace OpenSim.Region.Physics.OdePlugin
1407 } 1407 }
1408 1408
1409 // internal utility function: must be called within a lock (OdeLock) 1409 // internal utility function: must be called within a lock (OdeLock)
1410 protected void InternalAddActiveJoint(PhysicsJoint joint) 1410 private void InternalAddActiveJoint(PhysicsJoint joint)
1411 { 1411 {
1412 activeJoints.Add(joint); 1412 activeJoints.Add(joint);
1413 SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint); 1413 SOPName_to_activeJoint.Add(joint.ObjectNameInScene, joint);
1414 } 1414 }
1415 1415
1416 // internal utility function: must be called within a lock (OdeLock) 1416 // internal utility function: must be called within a lock (OdeLock)
1417 protected void InternalAddPendingJoint(OdePhysicsJoint joint) 1417 private void InternalAddPendingJoint(OdePhysicsJoint joint)
1418 { 1418 {
1419 pendingJoints.Add(joint); 1419 pendingJoints.Add(joint);
1420 SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint); 1420 SOPName_to_pendingJoint.Add(joint.ObjectNameInScene, joint);
1421 } 1421 }
1422 1422
1423 // internal utility function: must be called within a lock (OdeLock) 1423 // internal utility function: must be called within a lock (OdeLock)
1424 protected void InternalRemovePendingJoint(PhysicsJoint joint) 1424 private void InternalRemovePendingJoint(PhysicsJoint joint)
1425 { 1425 {
1426 pendingJoints.Remove(joint); 1426 pendingJoints.Remove(joint);
1427 SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene); 1427 SOPName_to_pendingJoint.Remove(joint.ObjectNameInScene);
1428 } 1428 }
1429 1429
1430 // internal utility function: must be called within a lock (OdeLock) 1430 // internal utility function: must be called within a lock (OdeLock)
1431 protected void InternalRemoveActiveJoint(PhysicsJoint joint) 1431 private void InternalRemoveActiveJoint(PhysicsJoint joint)
1432 { 1432 {
1433 activeJoints.Remove(joint); 1433 activeJoints.Remove(joint);
1434 SOPName_to_activeJoint.Remove(joint.ObjectNameInScene); 1434 SOPName_to_activeJoint.Remove(joint.ObjectNameInScene);
@@ -1482,7 +1482,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1482 } 1482 }
1483 } 1483 }
1484 1484
1485 protected void DeleteRequestedJoints() 1485 private void DeleteRequestedJoints()
1486 { 1486 {
1487 List<string> myRequestedJointsToBeDeleted; 1487 List<string> myRequestedJointsToBeDeleted;
1488 lock (externalJointRequestsLock) 1488 lock (externalJointRequestsLock)
@@ -1562,7 +1562,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1562 1562
1563 // for pending joints we don't know if their associated bodies exist yet or not. 1563 // for pending joints we don't know if their associated bodies exist yet or not.
1564 // the joint is actually created during processing of the taints 1564 // the joint is actually created during processing of the taints
1565 protected void CreateRequestedJoints() 1565 private void CreateRequestedJoints()
1566 { 1566 {
1567 List<PhysicsJoint> myRequestedJointsToBeCreated; 1567 List<PhysicsJoint> myRequestedJointsToBeCreated;
1568 lock (externalJointRequestsLock) 1568 lock (externalJointRequestsLock)
@@ -1648,7 +1648,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1648 return joint; 1648 return joint;
1649 } 1649 }
1650 1650
1651 protected void RemoveAllJointsConnectedToActor(PhysicsActor actor) 1651 private void RemoveAllJointsConnectedToActor(PhysicsActor actor)
1652 { 1652 {
1653 //m_log.Debug("RemoveAllJointsConnectedToActor: start"); 1653 //m_log.Debug("RemoveAllJointsConnectedToActor: start");
1654 if (actor.SOPName != null && joints_connecting_actor.ContainsKey(actor.SOPName) && joints_connecting_actor[actor.SOPName] != null) 1654 if (actor.SOPName != null && joints_connecting_actor.ContainsKey(actor.SOPName) && joints_connecting_actor[actor.SOPName] != null)