diff options
author | Robert Adams | 2016-01-18 07:02:48 -0800 |
---|---|---|
committer | Robert Adams | 2016-01-18 07:02:48 -0800 |
commit | 35d4298be698d9eb02974a4210c5ace867b0db35 (patch) | |
tree | ad3cb41a236cfceaac1629eaec919b522205b00a | |
parent | BulletSim: revert avatar stationary testing for having slight velocity. (diff) | |
download | opensim-SC-35d4298be698d9eb02974a4210c5ace867b0db35.zip opensim-SC-35d4298be698d9eb02974a4210c5ace867b0db35.tar.gz opensim-SC-35d4298be698d9eb02974a4210c5ace867b0db35.tar.bz2 opensim-SC-35d4298be698d9eb02974a4210c5ace867b0db35.tar.xz |
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.
6 files changed, 21 insertions, 17 deletions
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs index 3db8f2c..87cf972 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs | |||
@@ -211,7 +211,7 @@ public class BSActorMoveToTarget : BSActor | |||
211 | // Add enough force to overcome the mass of the object | 211 | // Add enough force to overcome the mass of the object |
212 | addedForce *= m_controllingPrim.Mass; | 212 | addedForce *= m_controllingPrim.Mass; |
213 | 213 | ||
214 | m_controllingPrim.AddForce(addedForce, false /* pushForce */, true /* inTaintTime */); | 214 | m_controllingPrim.AddForce(true /* inTaintTime */, addedForce); |
215 | } | 215 | } |
216 | m_physicsScene.DetailLog("{0},BSActorMoveToTarget.Mover3,move,fromPos={1},addedForce={2}", | 216 | m_physicsScene.DetailLog("{0},BSActorMoveToTarget.Mover3,move,fromPos={1},addedForce={2}", |
217 | m_controllingPrim.LocalID, origPosition, addedForce); | 217 | m_controllingPrim.LocalID, origPosition, addedForce); |
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs index a1cf4db..0261bcb 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs | |||
@@ -127,7 +127,7 @@ public class BSActorSetTorque : BSActor | |||
127 | m_physicsScene.DetailLog("{0},BSActorSetTorque,preStep,force={1}", m_controllingPrim.LocalID, m_controllingPrim.RawTorque); | 127 | m_physicsScene.DetailLog("{0},BSActorSetTorque,preStep,force={1}", m_controllingPrim.LocalID, m_controllingPrim.RawTorque); |
128 | if (m_controllingPrim.PhysBody.HasPhysicalBody) | 128 | if (m_controllingPrim.PhysBody.HasPhysicalBody) |
129 | { | 129 | { |
130 | m_controllingPrim.AddAngularForce(m_controllingPrim.RawTorque, false, true); | 130 | m_controllingPrim.AddAngularForce(true /* inTaintTime */, m_controllingPrim.RawTorque); |
131 | m_controllingPrim.ActivateIfPhysical(false); | 131 | m_controllingPrim.ActivateIfPhysical(false); |
132 | } | 132 | } |
133 | 133 | ||
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs index ab9cc27..0eb5fba 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs | |||
@@ -457,7 +457,7 @@ public sealed class BSCharacter : BSPhysObject | |||
457 | get { return RawVelocity; } | 457 | get { return RawVelocity; } |
458 | set { | 458 | set { |
459 | RawVelocity = value; | 459 | RawVelocity = value; |
460 | OMV.Vector3 vel = RawVelocity; | 460 | OMV.Vector3 vel = RawVelocity; |
461 | 461 | ||
462 | DetailLog("{0}: set Velocity = {1}", LocalID, value); | 462 | DetailLog("{0}: set Velocity = {1}", LocalID, value); |
463 | 463 | ||
@@ -662,10 +662,10 @@ public sealed class BSCharacter : BSPhysObject | |||
662 | addForce *= Mass * BSParam.AvatarAddForcePushFactor; | 662 | addForce *= Mass * BSParam.AvatarAddForcePushFactor; |
663 | 663 | ||
664 | DetailLog("{0},BSCharacter.addForce,call,force={1},addForce={2},push={3},mass={4}", LocalID, force, addForce, pushforce, Mass); | 664 | DetailLog("{0},BSCharacter.addForce,call,force={1},addForce={2},push={3},mass={4}", LocalID, force, addForce, pushforce, Mass); |
665 | AddForce(addForce, pushforce, false); | 665 | AddForce(false, addForce); |
666 | } | 666 | } |
667 | 667 | ||
668 | public override void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { | 668 | public override void AddForce(bool inTaintTime, OMV.Vector3 force) { |
669 | if (force.IsFinite()) | 669 | if (force.IsFinite()) |
670 | { | 670 | { |
671 | OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); | 671 | OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); |
@@ -692,7 +692,7 @@ public sealed class BSCharacter : BSPhysObject | |||
692 | } | 692 | } |
693 | } | 693 | } |
694 | 694 | ||
695 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { | 695 | public override void AddAngularForce(bool inTaintTime, OMV.Vector3 force) { |
696 | } | 696 | } |
697 | public override void SetMomentum(OMV.Vector3 momentum) { | 697 | public override void SetMomentum(OMV.Vector3 momentum) { |
698 | } | 698 | } |
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs b/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs index 0fc5577..313c961 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs | |||
@@ -768,7 +768,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS | |||
768 | } | 768 | } |
769 | 769 | ||
770 | if ((m_knownChanged & m_knownChangedForce) != 0) | 770 | if ((m_knownChanged & m_knownChangedForce) != 0) |
771 | ControllingPrim.AddForce((Vector3)m_knownForce, false /*pushForce*/, true /*inTaintTime*/); | 771 | ControllingPrim.AddForce(false /* inTaintTime */, (Vector3)m_knownForce); |
772 | 772 | ||
773 | if ((m_knownChanged & m_knownChangedForceImpulse) != 0) | 773 | if ((m_knownChanged & m_knownChangedForceImpulse) != 0) |
774 | ControllingPrim.AddForceImpulse((Vector3)m_knownForceImpulse, false /*pushforce*/, true /*inTaintTime*/); | 774 | ControllingPrim.AddForceImpulse((Vector3)m_knownForceImpulse, false /*pushforce*/, true /*inTaintTime*/); |
@@ -784,7 +784,7 @@ namespace OpenSim.Region.PhysicsModule.BulletS | |||
784 | 784 | ||
785 | if ((m_knownChanged & m_knownChangedRotationalForce) != 0) | 785 | if ((m_knownChanged & m_knownChangedRotationalForce) != 0) |
786 | { | 786 | { |
787 | ControllingPrim.AddAngularForce((Vector3)m_knownRotationalForce, false /*pushForce*/, true /*inTaintTime*/); | 787 | ControllingPrim.AddAngularForce(true /* inTaintTime */, (Vector3)m_knownRotationalForce); |
788 | } | 788 | } |
789 | 789 | ||
790 | // If we set one of the values (ie, the physics engine didn't do it) we must force | 790 | // If we set one of the values (ie, the physics engine didn't do it) we must force |
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs index b50e4cc..ff6baca 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs | |||
@@ -245,10 +245,10 @@ public abstract class BSPhysObject : PhysicsActor | |||
245 | 245 | ||
246 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) | 246 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) |
247 | { | 247 | { |
248 | AddAngularForce(force, pushforce, false); | 248 | AddAngularForce(false, force); |
249 | } | 249 | } |
250 | public abstract void AddAngularForce(OMV.Vector3 force, bool pushforce, bool inTaintTime); | 250 | public abstract void AddAngularForce(bool inTaintTime, OMV.Vector3 force); |
251 | public abstract void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime); | 251 | public abstract void AddForce(bool inTaintTime, OMV.Vector3 force); |
252 | 252 | ||
253 | public abstract OMV.Vector3 ForceRotationalVelocity { get; set; } | 253 | public abstract OMV.Vector3 ForceRotationalVelocity { get; set; } |
254 | 254 | ||
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 | |||
394 | // Apply upforce and overcome gravity. | 394 | // Apply upforce and overcome gravity. |
395 | OMV.Vector3 correctionForce = upForce - PhysScene.DefaultGravity; | 395 | OMV.Vector3 correctionForce = upForce - PhysScene.DefaultGravity; |
396 | DetailLog("{0},BSPrim.PositionSanityCheck,applyForce,pos={1},upForce={2},correctionForce={3}", LocalID, RawPosition, upForce, correctionForce); | 396 | DetailLog("{0},BSPrim.PositionSanityCheck,applyForce,pos={1},upForce={2},correctionForce={3}", LocalID, RawPosition, upForce, correctionForce); |
397 | AddForce(correctionForce, false, inTaintTime); | 397 | AddForce(inTaintTime, correctionForce); |
398 | ret = true; | 398 | ret = true; |
399 | } | 399 | } |
400 | } | 400 | } |
@@ -1249,14 +1249,18 @@ public class BSPrim : BSPhysObject | |||
1249 | // Per documentation, max force is limited. | 1249 | // Per documentation, max force is limited. |
1250 | OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); | 1250 | OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); |
1251 | 1251 | ||
1252 | // Since this force is being applied in only one step, make this a force per second. | 1252 | // Push forces seem to be scaled differently (follow pattern in ubODE) |
1253 | addForce /= PhysScene.LastTimeStep; | 1253 | if (!pushforce) { |
1254 | AddForce(addForce, pushforce, false /* inTaintTime */); | 1254 | // Since this force is being applied in only one step, make this a force per second. |
1255 | addForce /= PhysScene.LastTimeStep; | ||
1256 | } | ||
1257 | |||
1258 | AddForce(false /* inTaintTime */, addForce); | ||
1255 | } | 1259 | } |
1256 | 1260 | ||
1257 | // Applying a force just adds this to the total force on the object. | 1261 | // Applying a force just adds this to the total force on the object. |
1258 | // This added force will only last the next simulation tick. | 1262 | // This added force will only last the next simulation tick. |
1259 | public override void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { | 1263 | public override void AddForce(bool inTaintTime, OMV.Vector3 force) { |
1260 | // for an object, doesn't matter if force is a pushforce or not | 1264 | // for an object, doesn't matter if force is a pushforce or not |
1261 | if (IsPhysicallyActive) | 1265 | if (IsPhysicallyActive) |
1262 | { | 1266 | { |
@@ -1315,7 +1319,7 @@ public class BSPrim : BSPhysObject | |||
1315 | } | 1319 | } |
1316 | 1320 | ||
1317 | // BSPhysObject.AddAngularForce() | 1321 | // BSPhysObject.AddAngularForce() |
1318 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) | 1322 | public override void AddAngularForce(bool inTaintTime, OMV.Vector3 force) |
1319 | { | 1323 | { |
1320 | if (force.IsFinite()) | 1324 | if (force.IsFinite()) |
1321 | { | 1325 | { |