diff options
author | Robert Adams | 2012-10-10 13:56:16 -0700 |
---|---|---|
committer | Robert Adams | 2012-10-11 14:01:18 -0700 |
commit | 3a458e2a36253f6514720213deaa19372b06cc52 (patch) | |
tree | 7d0d849232391402e74bf83909e4256ce890abb5 /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |
parent | BulletSim: Change defaults for constraint CFM and ERP to make large linksets ... (diff) | |
download | opensim-SC_OLD-3a458e2a36253f6514720213deaa19372b06cc52.zip opensim-SC_OLD-3a458e2a36253f6514720213deaa19372b06cc52.tar.gz opensim-SC_OLD-3a458e2a36253f6514720213deaa19372b06cc52.tar.bz2 opensim-SC_OLD-3a458e2a36253f6514720213deaa19372b06cc52.tar.xz |
BulletSim: Use full linkset mass when computing vehicle gravity force. Add taint-time specification to new AddForce().
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index b26f049..692713d 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -855,6 +855,9 @@ public sealed class BSPrim : BSPhysObject | |||
855 | 855 | ||
856 | private List<OMV.Vector3> m_accumulatedForces = new List<OMV.Vector3>(); | 856 | private List<OMV.Vector3> m_accumulatedForces = new List<OMV.Vector3>(); |
857 | public override void AddForce(OMV.Vector3 force, bool pushforce) { | 857 | public override void AddForce(OMV.Vector3 force, bool pushforce) { |
858 | AddForce(force, pushforce, false); | ||
859 | } | ||
860 | public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { | ||
858 | // for an object, doesn't matter if force is a pushforce or not | 861 | // for an object, doesn't matter if force is a pushforce or not |
859 | if (force.IsFinite()) | 862 | if (force.IsFinite()) |
860 | { | 863 | { |
@@ -867,11 +870,12 @@ public sealed class BSPrim : BSPhysObject | |||
867 | m_log.WarnFormat("{0}: Got a NaN force applied to a prim. LocalID={1}", LogHeader, LocalID); | 870 | m_log.WarnFormat("{0}: Got a NaN force applied to a prim. LocalID={1}", LogHeader, LocalID); |
868 | return; | 871 | return; |
869 | } | 872 | } |
870 | PhysicsScene.TaintedObject("BSPrim.AddForce", delegate() | 873 | BSScene.TaintCallback addForceOperation = delegate() |
871 | { | 874 | { |
872 | OMV.Vector3 fSum = OMV.Vector3.Zero; | 875 | OMV.Vector3 fSum = OMV.Vector3.Zero; |
873 | lock (m_accumulatedForces) | 876 | lock (m_accumulatedForces) |
874 | { | 877 | { |
878 | // Sum the accumulated additional forces for one big force to apply once. | ||
875 | foreach (OMV.Vector3 v in m_accumulatedForces) | 879 | foreach (OMV.Vector3 v in m_accumulatedForces) |
876 | { | 880 | { |
877 | fSum += v; | 881 | fSum += v; |
@@ -881,7 +885,11 @@ public sealed class BSPrim : BSPhysObject | |||
881 | // DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, fSum); | 885 | // DetailLog("{0},BSPrim.AddObjectForce,taint,force={1}", LocalID, fSum); |
882 | // For unknown reasons, "ApplyCentralForce" adds this force to the total force on the object. | 886 | // For unknown reasons, "ApplyCentralForce" adds this force to the total force on the object. |
883 | BulletSimAPI.ApplyCentralForce2(BSBody.ptr, fSum); | 887 | BulletSimAPI.ApplyCentralForce2(BSBody.ptr, fSum); |
884 | }); | 888 | }; |
889 | if (inTaintTime) | ||
890 | addForceOperation(); | ||
891 | else | ||
892 | PhysicsScene.TaintedObject("BSPrim.AddForce", addForceOperation); | ||
885 | } | 893 | } |
886 | 894 | ||
887 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { | 895 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { |