aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
diff options
context:
space:
mode:
authorRobert Adams2012-07-12 15:34:25 -0700
committerRobert Adams2012-07-20 14:02:24 -0700
commitc400918c84fc89ff0209ee05def3bb46206ba5ee (patch)
treefc28a498207e20136a87528b937ec619ab3cbe3a /OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
parentBulletSim: Add detailed and voluminous debug logging that is enabled (diff)
downloadopensim-SC_OLD-c400918c84fc89ff0209ee05def3bb46206ba5ee.zip
opensim-SC_OLD-c400918c84fc89ff0209ee05def3bb46206ba5ee.tar.gz
opensim-SC_OLD-c400918c84fc89ff0209ee05def3bb46206ba5ee.tar.bz2
opensim-SC_OLD-c400918c84fc89ff0209ee05def3bb46206ba5ee.tar.xz
BulletSim: Add PID variables to physical scene. Not PIDing yet, but soon.
Cleaned up code and got rid of compile warnings.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index eb1d798..150326e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -107,6 +107,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
107 private long m_simulationStep = 0; 107 private long m_simulationStep = 0;
108 public long SimulationStep { get { return m_simulationStep; } } 108 public long SimulationStep { get { return m_simulationStep; } }
109 109
110 public float LastSimulatedTimestep { get; private set; }
111
110 // A value of the time now so all the collision and update routines do not have to get their own 112 // A value of the time now so all the collision and update routines do not have to get their own
111 // Set to 'now' just before all the prims and actors are called for collisions and updates 113 // Set to 'now' just before all the prims and actors are called for collisions and updates
112 private int m_simulationNowTime; 114 private int m_simulationNowTime;
@@ -123,6 +125,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
123 private bool _meshSculptedPrim = true; // cause scuplted prims to get meshed 125 private bool _meshSculptedPrim = true; // cause scuplted prims to get meshed
124 private bool _forceSimplePrimMeshing = false; // if a cube or sphere, let Bullet do internal shapes 126 private bool _forceSimplePrimMeshing = false; // if a cube or sphere, let Bullet do internal shapes
125 127
128 public float PID_D { get; private set; } // derivative
129 public float PID_P { get; private set; } // proportional
130
126 public const uint TERRAIN_ID = 0; // OpenSim senses terrain with a localID of zero 131 public const uint TERRAIN_ID = 0; // OpenSim senses terrain with a localID of zero
127 public const uint GROUNDPLANE_ID = 1; 132 public const uint GROUNDPLANE_ID = 1;
128 133
@@ -222,6 +227,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
222 m_maxUpdatesPerFrame = 2048; 227 m_maxUpdatesPerFrame = 2048;
223 m_maximumObjectMass = 10000.01f; 228 m_maximumObjectMass = 10000.01f;
224 229
230 PID_D = 2200f;
231 PID_P = 900f;
232
225 parms.defaultFriction = 0.5f; 233 parms.defaultFriction = 0.5f;
226 parms.defaultDensity = 10.000006836f; // Aluminum g/cm3 234 parms.defaultDensity = 10.000006836f; // Aluminum g/cm3
227 parms.defaultRestitution = 0f; 235 parms.defaultRestitution = 0f;
@@ -278,6 +286,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
278 m_maxUpdatesPerFrame = pConfig.GetInt("MaxUpdatesPerFrame", m_maxUpdatesPerFrame); 286 m_maxUpdatesPerFrame = pConfig.GetInt("MaxUpdatesPerFrame", m_maxUpdatesPerFrame);
279 m_maximumObjectMass = pConfig.GetFloat("MaxObjectMass", m_maximumObjectMass); 287 m_maximumObjectMass = pConfig.GetFloat("MaxObjectMass", m_maximumObjectMass);
280 288
289 PID_D = pConfig.GetFloat("PIDDerivative", PID_D);
290 PID_P = pConfig.GetFloat("PIDProportional", PID_P);
291
281 parms.defaultFriction = pConfig.GetFloat("DefaultFriction", parms.defaultFriction); 292 parms.defaultFriction = pConfig.GetFloat("DefaultFriction", parms.defaultFriction);
282 parms.defaultDensity = pConfig.GetFloat("DefaultDensity", parms.defaultDensity); 293 parms.defaultDensity = pConfig.GetFloat("DefaultDensity", parms.defaultDensity);
283 parms.defaultRestitution = pConfig.GetFloat("DefaultRestitution", parms.defaultRestitution); 294 parms.defaultRestitution = pConfig.GetFloat("DefaultRestitution", parms.defaultRestitution);
@@ -415,6 +426,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
415 int collidersCount; 426 int collidersCount;
416 IntPtr collidersPtr; 427 IntPtr collidersPtr;
417 428
429 LastSimulatedTimestep = timeStep;
430
418 // prevent simulation until we've been initialized 431 // prevent simulation until we've been initialized
419 if (!m_initialized) return 10.0f; 432 if (!m_initialized) return 10.0f;
420 433