aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
authorRobert Adams2012-12-26 10:25:50 -0800
committerRobert Adams2012-12-26 10:25:50 -0800
commit225b564573a5ac12ca1b1e592834476feccf8ebb (patch)
tree4adccb61ae3850d07b458c0c594e83812d7bac4d /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
parentBulletSim: make llBuoyancy work. For some reason, Bullet resets an (diff)
downloadopensim-SC_OLD-225b564573a5ac12ca1b1e592834476feccf8ebb.zip
opensim-SC_OLD-225b564573a5ac12ca1b1e592834476feccf8ebb.tar.gz
opensim-SC_OLD-225b564573a5ac12ca1b1e592834476feccf8ebb.tar.bz2
opensim-SC_OLD-225b564573a5ac12ca1b1e592834476feccf8ebb.tar.xz
BulletSim: scale the force for external AddForce by the simulation
step time so it will be applied completely the next step. The internal AddForce routine does not scale the force.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 0d13096..9013414 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -1014,7 +1014,9 @@ public sealed class BSPrim : BSPhysObject
1014 public override float APIDDamping { set { return; } } 1014 public override float APIDDamping { set { return; } }
1015 1015
1016 public override void AddForce(OMV.Vector3 force, bool pushforce) { 1016 public override void AddForce(OMV.Vector3 force, bool pushforce) {
1017 AddForce(force, pushforce, false); 1017 // Since this force is being applied in only one step, make this a force per second.
1018 OMV.Vector3 addForce = force / PhysicsScene.LastTimeStep;
1019 AddForce(addForce, pushforce, false);
1018 } 1020 }
1019 // Applying a force just adds this to the total force on the object. 1021 // Applying a force just adds this to the total force on the object.
1020 // This added force will only last the next simulation tick. 1022 // This added force will only last the next simulation tick.
@@ -1022,8 +1024,16 @@ public sealed class BSPrim : BSPhysObject
1022 // for an object, doesn't matter if force is a pushforce or not 1024 // for an object, doesn't matter if force is a pushforce or not
1023 if (force.IsFinite()) 1025 if (force.IsFinite())
1024 { 1026 {
1027 float magnitude = force.Length();
1028 if (magnitude > 20000f)
1029 {
1030 // Force has a limit
1031 force = force / magnitude * 20000f;
1032 }
1033
1025 OMV.Vector3 addForce = force; 1034 OMV.Vector3 addForce = force;
1026 DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce); 1035 DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce);
1036
1027 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() 1037 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate()
1028 { 1038 {
1029 // Bullet adds this central force to the total force for this tick 1039 // Bullet adds this central force to the total force for this tick