diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 12 |
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 |