From 35d4298be698d9eb02974a4210c5ace867b0db35 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 18 Jan 2016 07:02:48 -0800 Subject: BulletSim: change method signatures for internal AddForce methods to remove confusion about push forces. The latter is an external, physics engine interface feature (the force parameter has a different unit if pushing vs adding force) and that distinction is not used internally. --- OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs') diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs index 1d552eb..fd9b834 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs @@ -394,7 +394,7 @@ public class BSPrim : BSPhysObject // Apply upforce and overcome gravity. OMV.Vector3 correctionForce = upForce - PhysScene.DefaultGravity; DetailLog("{0},BSPrim.PositionSanityCheck,applyForce,pos={1},upForce={2},correctionForce={3}", LocalID, RawPosition, upForce, correctionForce); - AddForce(correctionForce, false, inTaintTime); + AddForce(inTaintTime, correctionForce); ret = true; } } @@ -1249,14 +1249,18 @@ public class BSPrim : BSPhysObject // Per documentation, max force is limited. OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); - // Since this force is being applied in only one step, make this a force per second. - addForce /= PhysScene.LastTimeStep; - AddForce(addForce, pushforce, false /* inTaintTime */); + // Push forces seem to be scaled differently (follow pattern in ubODE) + if (!pushforce) { + // Since this force is being applied in only one step, make this a force per second. + addForce /= PhysScene.LastTimeStep; + } + + AddForce(false /* inTaintTime */, addForce); } // Applying a force just adds this to the total force on the object. // This added force will only last the next simulation tick. - public override void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { + public override void AddForce(bool inTaintTime, OMV.Vector3 force) { // for an object, doesn't matter if force is a pushforce or not if (IsPhysicallyActive) { @@ -1315,7 +1319,7 @@ public class BSPrim : BSPhysObject } // BSPhysObject.AddAngularForce() - public override void AddAngularForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) + public override void AddAngularForce(bool inTaintTime, OMV.Vector3 force) { if (force.IsFinite()) { -- cgit v1.1