aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorRobert Adams2012-12-27 18:19:25 -0800
committerRobert Adams2012-12-27 22:12:28 -0800
commitc1e7539c77480b839d513dbb7db74aa8f260eba0 (patch)
treec67c637a678b0ec432438eb56a66481a258eab19 /OpenSim/Region/Physics
parentBulletSim: move logic for IsColliding, CollidingGround and CollidingObj from ... (diff)
downloadopensim-SC_OLD-c1e7539c77480b839d513dbb7db74aa8f260eba0.zip
opensim-SC_OLD-c1e7539c77480b839d513dbb7db74aa8f260eba0.tar.gz
opensim-SC_OLD-c1e7539c77480b839d513dbb7db74aa8f260eba0.tar.bz2
opensim-SC_OLD-c1e7539c77480b839d513dbb7db74aa8f260eba0.tar.xz
BulletSim: Parameterize nominal frame rate (55) and add parameters to dynamially turn on/off detailed, unmanaged data dumping of prims and vehicles.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs6
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs5
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs11
4 files changed, 21 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index a8edd23..0bdfbe3 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -822,6 +822,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
822 { 822 {
823 if (!IsActive) return; 823 if (!IsActive) return;
824 824
825 if (PhysicsScene.VehiclePhysicalLoggingEnabled)
826 BulletSimAPI.DumpRigidBody2(PhysicsScene.World.ptr, Prim.PhysBody.ptr);
827
825 ForgetKnownVehicleProperties(); 828 ForgetKnownVehicleProperties();
826 829
827 MoveLinear(pTimestep); 830 MoveLinear(pTimestep);
@@ -836,6 +839,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
836 // for the physics engine to note the changes so an UpdateProperties event will happen. 839 // for the physics engine to note the changes so an UpdateProperties event will happen.
837 PushKnownChanged(); 840 PushKnownChanged();
838 841
842 if (PhysicsScene.VehiclePhysicalLoggingEnabled)
843 BulletSimAPI.DumpRigidBody2(PhysicsScene.World.ptr, Prim.PhysBody.ptr);
844
839 VDetailLog("{0},BSDynamics.Step,done,pos={1},force={2},velocity={3},angvel={4}", 845 VDetailLog("{0},BSDynamics.Step,done,pos={1},force={2},velocity={3},angvel={4}",
840 Prim.LocalID, VehiclePosition, Prim.Force, VehicleVelocity, VehicleRotationalVelocity); 846 Prim.LocalID, VehiclePosition, Prim.Force, VehicleVelocity, VehicleRotationalVelocity);
841 } 847 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 8366cef..f8f24bd 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -212,6 +212,11 @@ public static class BSParam
212 (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); }, 212 (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); },
213 (s) => { return (float)s.m_fixedTimeStep; }, 213 (s) => { return (float)s.m_fixedTimeStep; },
214 (s,p,l,v) => { s.m_fixedTimeStep = v; } ), 214 (s,p,l,v) => { s.m_fixedTimeStep = v; } ),
215 new ParameterDefn("NominalFrameRate", "The base frame rate we claim",
216 55f,
217 (s,cf,p,v) => { s.NominalFrameRate = cf.GetInt(p, (int)v); },
218 (s) => { return (float)s.NominalFrameRate; },
219 (s,p,l,v) => { s.NominalFrameRate = (int)v; } ),
215 new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", 220 new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame",
216 2048f, 221 2048f,
217 (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); }, 222 (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); },
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 06e4ada..2d429c4 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -758,8 +758,8 @@ public sealed class BSPrim : BSPhysObject
758 // For compound based linksets, this enables and disables interactions of the children. 758 // For compound based linksets, this enables and disables interactions of the children.
759 Linkset.Refresh(this); 759 Linkset.Refresh(this);
760 760
761 DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},body={6},shape={7}", 761 DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},cType={6},body={7},shape={8}",
762 LocalID, IsStatic, IsSolid, Mass, SubscribedEvents(), CurrentCollisionFlags, PhysBody, PhysShape); 762 LocalID, IsStatic, IsSolid, Mass, SubscribedEvents(), CurrentCollisionFlags, PhysBody.collisionType, PhysBody, PhysShape);
763 } 763 }
764 764
765 // "Making dynamic" means changing to and from static. 765 // "Making dynamic" means changing to and from static.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index a5fbf10..8edcd20 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -74,6 +74,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
74 internal int m_maxSubSteps; 74 internal int m_maxSubSteps;
75 internal float m_fixedTimeStep; 75 internal float m_fixedTimeStep;
76 internal long m_simulationStep = 0; 76 internal long m_simulationStep = 0;
77 internal float NominalFrameRate { get; set; }
77 public long SimulationStep { get { return m_simulationStep; } } 78 public long SimulationStep { get { return m_simulationStep; } }
78 internal int m_taintsToProcessPerStep; 79 internal int m_taintsToProcessPerStep;
79 internal float LastTimeStep { get; private set; } 80 internal float LastTimeStep { get; private set; }
@@ -162,6 +163,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
162 private string m_physicsLoggingPrefix; 163 private string m_physicsLoggingPrefix;
163 private int m_physicsLoggingFileMinutes; 164 private int m_physicsLoggingFileMinutes;
164 private bool m_physicsLoggingDoFlush; 165 private bool m_physicsLoggingDoFlush;
166 private bool m_physicsPhysicalDumpEnabled;
165 // 'true' of the vehicle code is to log lots of details 167 // 'true' of the vehicle code is to log lots of details
166 public bool VehicleLoggingEnabled { get; private set; } 168 public bool VehicleLoggingEnabled { get; private set; }
167 public bool VehiclePhysicalLoggingEnabled { get; private set; } 169 public bool VehiclePhysicalLoggingEnabled { get; private set; }
@@ -272,6 +274,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
272 m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-"); 274 m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-");
273 m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5); 275 m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5);
274 m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false); 276 m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false);
277 m_physicsPhysicalDumpEnabled = pConfig.GetBoolean("PhysicsPhysicalDumpEnabled", false);
275 // Very detailed logging for vehicle debugging 278 // Very detailed logging for vehicle debugging
276 VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false); 279 VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false);
277 VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false); 280 VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false);
@@ -488,7 +491,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
488 491
489 // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world. 492 // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world.
490 // Only enable this in a limited test world with few objects. 493 // Only enable this in a limited test world with few objects.
491 // BulletSimAPI.DumpAllInfo2(World.ptr); // DEBUG DEBUG DEBUG 494 if (m_physicsPhysicalDumpEnabled)
495 BulletSimAPI.DumpAllInfo2(World.ptr);
492 496
493 // step the physical world one interval 497 // step the physical world one interval
494 m_simulationStep++; 498 m_simulationStep++;
@@ -587,12 +591,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
587 591
588 // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world. 592 // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world.
589 // Only enable this in a limited test world with few objects. 593 // Only enable this in a limited test world with few objects.
590 // BulletSimAPI.DumpAllInfo2(World.ptr); // DEBUG DEBUG DEBUG 594 if (m_physicsPhysicalDumpEnabled)
595 BulletSimAPI.DumpAllInfo2(World.ptr);
591 596
592 // The physics engine returns the number of milliseconds it simulated this call. 597 // The physics engine returns the number of milliseconds it simulated this call.
593 // These are summed and normalized to one second and divided by 1000 to give the reported physics FPS. 598 // These are summed and normalized to one second and divided by 1000 to give the reported physics FPS.
594 // Multiply by 55 to give a nominal frame rate of 55. 599 // Multiply by 55 to give a nominal frame rate of 55.
595 return (float)numSubSteps * m_fixedTimeStep * 1000f * 55f; 600 return (float)numSubSteps * m_fixedTimeStep * 1000f * NominalFrameRate;
596 } 601 }
597 602
598 // Something has collided 603 // Something has collided