aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs33
1 files changed, 13 insertions, 20 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 79fe632..7aa2d92 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -132,8 +132,8 @@ public sealed class BSPrim : BSPhysObject
132 base.Destroy(); 132 base.Destroy();
133 133
134 // Undo any links between me and any other object 134 // Undo any links between me and any other object
135 BSPhysObject parentBefore = Linkset.LinksetRoot; 135 BSPhysObject parentBefore = Linkset.LinksetRoot; // DEBUG DEBUG
136 int childrenBefore = Linkset.NumberOfChildren; 136 int childrenBefore = Linkset.NumberOfChildren; // DEBUG DEBUG
137 137
138 Linkset = Linkset.RemoveMeFromLinkset(this); 138 Linkset = Linkset.RemoveMeFromLinkset(this);
139 139
@@ -727,6 +727,12 @@ public sealed class BSPrim : BSPhysObject
727 get { return !IsPhantom && !_isVolumeDetect; } 727 get { return !IsPhantom && !_isVolumeDetect; }
728 } 728 }
729 729
730 // The object is moving and is actively being dynamic in the physical world
731 public override bool IsPhysicallyActive
732 {
733 get { return !_isSelected && IsPhysical; }
734 }
735
730 // Make gravity work if the object is physical and not selected 736 // Make gravity work if the object is physical and not selected
731 // Called at taint-time!! 737 // Called at taint-time!!
732 private void SetObjectDynamic(bool forceRebuild) 738 private void SetObjectDynamic(bool forceRebuild)
@@ -1174,18 +1180,11 @@ public sealed class BSPrim : BSPhysObject
1174 // This added force will only last the next simulation tick. 1180 // This added force will only last the next simulation tick.
1175 public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { 1181 public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) {
1176 // for an object, doesn't matter if force is a pushforce or not 1182 // for an object, doesn't matter if force is a pushforce or not
1177 if (!IsStatic) 1183 if (IsPhysicallyActive)
1178 { 1184 {
1179 if (force.IsFinite()) 1185 if (force.IsFinite())
1180 { 1186 {
1181 float magnitude = force.Length(); 1187 OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude);
1182 if (magnitude > BSParam.MaxAddForceMagnitude)
1183 {
1184 // Force has a limit
1185 force = force / magnitude * BSParam.MaxAddForceMagnitude;
1186 }
1187
1188 OMV.Vector3 addForce = force;
1189 // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce); 1188 // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce);
1190 1189
1191 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() 1190 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate()
@@ -1209,19 +1208,13 @@ public sealed class BSPrim : BSPhysObject
1209 1208
1210 public void AddForceImpulse(OMV.Vector3 impulse, bool pushforce, bool inTaintTime) { 1209 public void AddForceImpulse(OMV.Vector3 impulse, bool pushforce, bool inTaintTime) {
1211 // for an object, doesn't matter if force is a pushforce or not 1210 // for an object, doesn't matter if force is a pushforce or not
1212 if (!IsStatic) 1211 if (!IsPhysicallyActive)
1213 { 1212 {
1214 if (impulse.IsFinite()) 1213 if (impulse.IsFinite())
1215 { 1214 {
1216 float magnitude = impulse.Length(); 1215 OMV.Vector3 addImpulse = Util.ClampV(impulse, BSParam.MaxAddForceMagnitude);
1217 if (magnitude > BSParam.MaxAddForceMagnitude)
1218 {
1219 // Force has a limit
1220 impulse = impulse / magnitude * BSParam.MaxAddForceMagnitude;
1221 }
1222
1223 // DetailLog("{0},BSPrim.addForceImpulse,call,impulse={1}", LocalID, impulse); 1216 // DetailLog("{0},BSPrim.addForceImpulse,call,impulse={1}", LocalID, impulse);
1224 OMV.Vector3 addImpulse = impulse; 1217
1225 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddImpulse", delegate() 1218 PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddImpulse", delegate()
1226 { 1219 {
1227 // Bullet adds this impulse immediately to the velocity 1220 // Bullet adds this impulse immediately to the velocity