diff options
author | Robert Adams | 2012-12-11 00:13:13 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-11 00:13:13 -0800 |
commit | 8b861e880ad128edc0267b8e2d5931cfc8a142bc (patch) | |
tree | 5b003bc0c79c2d3c7f4efa0de1ba6d75db5a1bdf /OpenSim/Region/Physics/BulletSPlugin | |
parent | BulletSim: set mass for single prim linksets when going physical. This fixes ... (diff) | |
download | opensim-SC-8b861e880ad128edc0267b8e2d5931cfc8a142bc.zip opensim-SC-8b861e880ad128edc0267b8e2d5931cfc8a142bc.tar.gz opensim-SC-8b861e880ad128edc0267b8e2d5931cfc8a142bc.tar.bz2 opensim-SC-8b861e880ad128edc0267b8e2d5931cfc8a142bc.tar.xz |
BulletSim: add ini file and command line parameters to control
dumping of physical vehicle parameters (out of Bullet) on each
simulation step and to optionally scale vehicle angular velocity
by the time step. The latter looks to be part of a difference
between angular parameters for ODE and BulletSim. SL docs say
angular velocity is measured in radians/timeScale. Not sure if this
is different than what ODE does.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
4 files changed, 22 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index cb84456..acddc09 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -570,8 +570,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
570 | BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia); | 570 | BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia); |
571 | BulletSimAPI.UpdateInertiaTensor2(Prim.PhysBody.ptr); | 571 | BulletSimAPI.UpdateInertiaTensor2(Prim.PhysBody.ptr); |
572 | 572 | ||
573 | VDetailLog("{0},BSDynamics.Refresh,frict={1},inert={2},aDamp={3}", | 573 | VDetailLog("{0},BSDynamics.Refresh,mass={1},frict={2},inert={3},aDamp={4}", |
574 | Prim.LocalID, friction, localInertia, angularDamping); | 574 | Prim.LocalID, m_vehicleMass, friction, localInertia, angularDamping); |
575 | } | 575 | } |
576 | else | 576 | else |
577 | { | 577 | { |
@@ -1057,7 +1057,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1057 | // TODO: Should this be applied as an angular force (torque)? | 1057 | // TODO: Should this be applied as an angular force (torque)? |
1058 | if (!m_lastAngularCorrection.ApproxEquals(Vector3.Zero, 0.01f)) | 1058 | if (!m_lastAngularCorrection.ApproxEquals(Vector3.Zero, 0.01f)) |
1059 | { | 1059 | { |
1060 | Vector3 scaledCorrection = m_lastAngularCorrection * pTimestep; | 1060 | // DEBUG DEBUG DEBUG: optionally scale the angular velocity. Debugging SL vs ODE turning functions. |
1061 | Vector3 scaledCorrection = m_lastAngularCorrection; | ||
1062 | if (PhysicsScene.VehicleScaleAngularVelocityByTimestep) | ||
1063 | scaledCorrection *= pTimestep; | ||
1061 | VehicleRotationalVelocity = scaledCorrection; | 1064 | VehicleRotationalVelocity = scaledCorrection; |
1062 | 1065 | ||
1063 | VDetailLog("{0}, MoveAngular,done,nonZero,angMotorContrib={1},vertAttrContrib={2},bankContrib={3},deflectContrib={4},totalContrib={5},scaledCorr={6}", | 1066 | VDetailLog("{0}, MoveAngular,done,nonZero,angMotorContrib={1},vertAttrContrib={2},bankContrib={3},deflectContrib={4},totalContrib={5},scaledCorr={6}", |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 17cc7b4..f4f2801 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -188,6 +188,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
188 | private bool m_physicsLoggingDoFlush; | 188 | private bool m_physicsLoggingDoFlush; |
189 | // 'true' of the vehicle code is to log lots of details | 189 | // 'true' of the vehicle code is to log lots of details |
190 | public bool VehicleLoggingEnabled { get; private set; } | 190 | public bool VehicleLoggingEnabled { get; private set; } |
191 | public bool VehiclePhysicalLoggingEnabled { get; private set; } | ||
192 | public bool VehicleScaleAngularVelocityByTimestep { get; private set; } | ||
191 | 193 | ||
192 | #region Construction and Initialization | 194 | #region Construction and Initialization |
193 | public BSScene(string identifier) | 195 | public BSScene(string identifier) |
@@ -297,6 +299,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
297 | m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false); | 299 | m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false); |
298 | // Very detailed logging for vehicle debugging | 300 | // Very detailed logging for vehicle debugging |
299 | VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false); | 301 | VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false); |
302 | VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false); | ||
300 | 303 | ||
301 | // Do any replacements in the parameters | 304 | // Do any replacements in the parameters |
302 | m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName); | 305 | m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName); |
@@ -501,7 +504,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
501 | 504 | ||
502 | try | 505 | try |
503 | { | 506 | { |
504 | // if (VehicleLoggingEnabled) DumpVehicles(); // DEBUG | 507 | if (VehiclePhysicalLoggingEnabled) DumpVehicles(); // DEBUG |
505 | if (PhysicsLogging.Enabled) beforeTime = Util.EnvironmentTickCount(); | 508 | if (PhysicsLogging.Enabled) beforeTime = Util.EnvironmentTickCount(); |
506 | 509 | ||
507 | numSubSteps = BulletSimAPI.PhysicsStep2(World.ptr, timeStep, m_maxSubSteps, m_fixedTimeStep, | 510 | numSubSteps = BulletSimAPI.PhysicsStep2(World.ptr, timeStep, m_maxSubSteps, m_fixedTimeStep, |
@@ -510,7 +513,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
510 | if (PhysicsLogging.Enabled) simTime = Util.EnvironmentTickCountSubtract(beforeTime); | 513 | if (PhysicsLogging.Enabled) simTime = Util.EnvironmentTickCountSubtract(beforeTime); |
511 | DetailLog("{0},Simulate,call, frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}", | 514 | DetailLog("{0},Simulate,call, frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}", |
512 | DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, updatedEntityCount, collidersCount); | 515 | DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, updatedEntityCount, collidersCount); |
513 | // if (VehicleLoggingEnabled) DumpVehicles(); // DEBUG | 516 | if (VehiclePhysicalLoggingEnabled) DumpVehicles(); // DEBUG |
514 | } | 517 | } |
515 | catch (Exception e) | 518 | catch (Exception e) |
516 | { | 519 | { |
@@ -1226,6 +1229,11 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
1226 | (s,cf,p,v) => { s.m_params[0].vehicleAngularDamping = cf.GetFloat(p, v); }, | 1229 | (s,cf,p,v) => { s.m_params[0].vehicleAngularDamping = cf.GetFloat(p, v); }, |
1227 | (s) => { return s.m_params[0].vehicleAngularDamping; }, | 1230 | (s) => { return s.m_params[0].vehicleAngularDamping; }, |
1228 | (s,p,l,v) => { s.m_params[0].vehicleAngularDamping = v; } ), | 1231 | (s,p,l,v) => { s.m_params[0].vehicleAngularDamping = v; } ), |
1232 | new ParameterDefn("VehicleScaleAngularVelocityByTimestep", "If true, scale angular turning by timestep", | ||
1233 | ConfigurationParameters.numericFalse, | ||
1234 | (s,cf,p,v) => { s.VehicleScaleAngularVelocityByTimestep = cf.GetBoolean(p, s.BoolNumeric(v)); }, | ||
1235 | (s) => { return s.NumericBool(s.VehicleScaleAngularVelocityByTimestep); }, | ||
1236 | (s,p,l,v) => { s.VehicleScaleAngularVelocityByTimestep = s.BoolNumeric(v); } ), | ||
1229 | 1237 | ||
1230 | new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", | 1238 | new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", |
1231 | 0f, | 1239 | 0f, |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 74b4371..4ab9a99 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -793,7 +793,7 @@ public sealed class BSShapeCollection : IDisposable | |||
793 | BulletShape newShape = new BulletShape(hullPtr, BSPhysicsShapeType.SHAPE_HULL); | 793 | BulletShape newShape = new BulletShape(hullPtr, BSPhysicsShapeType.SHAPE_HULL); |
794 | newShape.shapeKey = newHullKey; | 794 | newShape.shapeKey = newHullKey; |
795 | 795 | ||
796 | return newShape; // 'true' means a new shape has been added to this prim | 796 | return newShape; |
797 | } | 797 | } |
798 | 798 | ||
799 | // Callback from convex hull creater with a newly created hull. | 799 | // Callback from convex hull creater with a newly created hull. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index a2161c3..4b6e9a4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -38,7 +38,8 @@ Disable activity of passive linkset children. | |||
38 | Scenes with hundred of thousands of static objects take a lot of physics CPU time. | 38 | Scenes with hundred of thousands of static objects take a lot of physics CPU time. |
39 | BSPrim.Force should set a continious force on the prim. The force should be | 39 | BSPrim.Force should set a continious force on the prim. The force should be |
40 | applied each tick. Some limits? | 40 | applied each tick. Some limits? |
41 | Single prim vehicles don't seem to properly vehiclize. | 41 | Linksets should allow collisions to individual children |
42 | Add LocalID to children shapes in LinksetCompound and create events for individuals | ||
42 | Gun sending shooter flying. | 43 | Gun sending shooter flying. |
43 | Collision margin (gap between physical objects lying on each other) | 44 | Collision margin (gap between physical objects lying on each other) |
44 | Boundry checking (crashes related to crossing boundry) | 45 | Boundry checking (crashes related to crossing boundry) |
@@ -145,4 +146,6 @@ Linkset implementation using compound shapes. (Resolution: implemented LinksetCo | |||
145 | Light cycle falling over when driving (Resolution: implemented VerticalAttractor) | 146 | Light cycle falling over when driving (Resolution: implemented VerticalAttractor) |
146 | Light cycle not banking (Resolution: It doesn't. Banking is roll adding yaw.) | 147 | Light cycle not banking (Resolution: It doesn't. Banking is roll adding yaw.) |
147 | Package Bullet source mods for Bullet internal stats output | 148 | Package Bullet source mods for Bullet internal stats output |
148 | (Resolution: move code into WorldData.h rather than relying on patches) \ No newline at end of file | 149 | (Resolution: move code into WorldData.h rather than relying on patches) |
150 | Single prim vehicles don't seem to properly vehiclize. | ||
151 | (Resolution: mass was not getting set properly for single prim linksets) | ||