aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/PhysicsModules')
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs97
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs2
-rw-r--r--OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs13
-rw-r--r--OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs4
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSParam.cs2
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs17
-rw-r--r--OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs16
8 files changed, 74 insertions, 79 deletions
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs
index 12ffacb..79ee00f 100755
--- a/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs
@@ -47,10 +47,9 @@ public class BSActorAvatarMove : BSActor
47 // The amount the step up is applying. Used to smooth stair walking. 47 // The amount the step up is applying. Used to smooth stair walking.
48 float m_lastStepUp; 48 float m_lastStepUp;
49 49
50 // Jumping happens over several frames. If use applies up force while colliding, start the 50 // There are times the velocity is set but we don't want to inforce stationary until the
51 // jump and allow the jump to continue for this number of frames. 51 // real velocity drops.
52 int m_jumpFrames = 0; 52 bool m_waitingForLowVelocityForStationary = false;
53 float m_jumpVelocity = 0f;
54 53
55 public BSActorAvatarMove(BSScene physicsScene, BSPhysObject pObj, string actorName) 54 public BSActorAvatarMove(BSScene physicsScene, BSPhysObject pObj, string actorName)
56 : base(physicsScene, pObj, actorName) 55 : base(physicsScene, pObj, actorName)
@@ -117,11 +116,19 @@ public class BSActorAvatarMove : BSActor
117 m_velocityMotor.SetTarget(targ); 116 m_velocityMotor.SetTarget(targ);
118 m_velocityMotor.SetCurrent(vel); 117 m_velocityMotor.SetCurrent(vel);
119 m_velocityMotor.Enabled = true; 118 m_velocityMotor.Enabled = true;
119 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,SetVelocityAndTarget,vel={1}, targ={2}",
120 m_controllingPrim.LocalID, vel, targ);
121 m_waitingForLowVelocityForStationary = false;
120 } 122 }
121 }); 123 });
122 } 124 }
123 125
124 // If a hover motor has not been created, create one and start the hovering. 126 public void SuppressStationayCheckUntilLowVelocity()
127 {
128 m_waitingForLowVelocityForStationary = true;
129 }
130
131 // If a movement motor has not been created, create one and start the hovering.
125 private void ActivateAvatarMove() 132 private void ActivateAvatarMove()
126 { 133 {
127 if (m_velocityMotor == null) 134 if (m_velocityMotor == null)
@@ -133,13 +140,14 @@ public class BSActorAvatarMove : BSActor
133 1f // efficiency 140 1f // efficiency
134 ); 141 );
135 m_velocityMotor.ErrorZeroThreshold = BSParam.AvatarStopZeroThreshold; 142 m_velocityMotor.ErrorZeroThreshold = BSParam.AvatarStopZeroThreshold;
136 // _velocityMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG so motor will output detail log messages. 143 // m_velocityMotor.PhysicsScene = m_controllingPrim.PhysScene; // DEBUG DEBUG so motor will output detail log messages.
137 SetVelocityAndTarget(m_controllingPrim.RawVelocity, m_controllingPrim.TargetVelocity, true /* inTaintTime */); 144 SetVelocityAndTarget(m_controllingPrim.RawVelocity, m_controllingPrim.TargetVelocity, true /* inTaintTime */);
138 145
139 m_physicsScene.BeforeStep += Mover; 146 m_physicsScene.BeforeStep += Mover;
140 m_controllingPrim.OnPreUpdateProperty += Process_OnPreUpdateProperty; 147 m_controllingPrim.OnPreUpdateProperty += Process_OnPreUpdateProperty;
141 148
142 m_walkingUpStairs = 0; 149 m_walkingUpStairs = 0;
150 m_waitingForLowVelocityForStationary = false;
143 } 151 }
144 } 152 }
145 153
@@ -190,12 +198,15 @@ public class BSActorAvatarMove : BSActor
190 // if colliding with something stationary and we're not doing volume detect . 198 // if colliding with something stationary and we're not doing volume detect .
191 if (!m_controllingPrim.ColliderIsMoving && !m_controllingPrim.ColliderIsVolumeDetect) 199 if (!m_controllingPrim.ColliderIsMoving && !m_controllingPrim.ColliderIsVolumeDetect)
192 { 200 {
193 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,totalForce={1}, vel={2}", /* DEBUG */ 201 if (m_waitingForLowVelocityForStationary)
194 m_controllingPrim.LocalID, m_physicsScene.PE.GetTotalForce(m_controllingPrim.PhysBody), m_controllingPrim.Velocity); /* DEBUG */ 202 {
195 // If velocity is very small, assume it is movement creep and suppress it. 203 // if waiting for velocity to drop and it has finally dropped, we can be stationary
196 // Applying push forces (Character.AddForce) should move the avatar and that is only seen here as velocity. 204 if (m_controllingPrim.RawVelocity.LengthSquared() < BSParam.AvatarStopZeroThresholdSquared)
197 if ( (m_controllingPrim.Velocity.LengthSquared() < BSParam.AvatarStopZeroThresholdSquared) 205 {
198 && (m_physicsScene.PE.GetTotalForce(m_controllingPrim.PhysBody).LengthSquared() < BSParam.AvatarStopZeroThresholdSquared) ) 206 m_waitingForLowVelocityForStationary = false;
207 }
208 }
209 if (!m_waitingForLowVelocityForStationary)
199 { 210 {
200 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", m_controllingPrim.LocalID); 211 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", m_controllingPrim.LocalID);
201 m_controllingPrim.IsStationary = true; 212 m_controllingPrim.IsStationary = true;
@@ -203,8 +214,8 @@ public class BSActorAvatarMove : BSActor
203 } 214 }
204 else 215 else
205 { 216 {
206 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,not zeroing because velocity={1}", 217 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,waitingForLowVel,rawvel={1}",
207 m_controllingPrim.LocalID, m_controllingPrim.Velocity); 218 m_controllingPrim.LocalID, m_controllingPrim.RawVelocity.Length());
208 } 219 }
209 } 220 }
210 221
@@ -250,50 +261,24 @@ public class BSActorAvatarMove : BSActor
250 m_physicsScene.PE.SetFriction(m_controllingPrim.PhysBody, m_controllingPrim.Friction); 261 m_physicsScene.PE.SetFriction(m_controllingPrim.PhysBody, m_controllingPrim.Friction);
251 } 262 }
252 263
253 // If not flying and not colliding, assume falling and keep the downward motion component. 264 // 'm_velocityMotor is used for walking, flying, and jumping and will thus have the correct values
254 // This check is done here for the next jump test. 265 // for Z. But in come cases it must be over-ridden. Like when falling or jumping.
255 if (!m_controllingPrim.Flying && !m_controllingPrim.IsColliding)
256 {
257 stepVelocity.Z = m_controllingPrim.RawVelocity.Z;
258 }
259 266
260 // Colliding and not flying with an upward force. The avatar must be trying to jump. 267 float realVelocityZ = m_controllingPrim.RawVelocity.Z;
261 if (!m_controllingPrim.Flying && m_controllingPrim.IsColliding && stepVelocity.Z > 0)
262 {
263 // We allow the upward force to happen for this many frames.
264 m_jumpFrames = BSParam.AvatarJumpFrames;
265 m_jumpVelocity = stepVelocity.Z;
266 }
267 268
268 // The case where the avatar is not colliding and is not flying is special. 269 // If not flying and falling, we over-ride the stepping motor so we can fall to the ground
269 // The avatar is either falling or jumping and the user can be applying force to the avatar 270 if (!m_controllingPrim.Flying && realVelocityZ < 0)
270 // (force in some direction or force up or down).
271 // If the avatar has negative Z velocity and is not colliding, presume we're falling and keep the velocity.
272 // If the user is trying to apply upward force but we're not colliding, assume the avatar
273 // is trying to jump and don't apply the upward force if not touching the ground any more.
274 if (!m_controllingPrim.Flying && !m_controllingPrim.IsColliding)
275 { 271 {
276 // If upward velocity is being applied, this must be a jump and only allow that to go on so long 272 // Can't fall faster than this
277 if (m_jumpFrames > 0) 273 if (realVelocityZ < BSParam.AvatarTerminalVelocity)
278 { 274 {
279 // Since not touching the ground, only apply upward force for so long. 275 realVelocityZ = BSParam.AvatarTerminalVelocity;
280 m_jumpFrames--;
281 stepVelocity.Z = m_jumpVelocity;
282 } 276 }
283 else 277
284 { 278 stepVelocity.Z = realVelocityZ;
285 // Since we're not affected by anything, the avatar must be falling and we do not want that to be too fast.
286 if (m_controllingPrim.RawVelocity.Z < BSParam.AvatarTerminalVelocity)
287 {
288 stepVelocity.Z = BSParam.AvatarTerminalVelocity;
289 }
290 else
291 {
292 stepVelocity.Z = m_controllingPrim.RawVelocity.Z;
293 }
294 }
295 // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity);
296 } 279 }
280 // m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,DEBUG,motorCurrent={1},realZ={2},flying={3},collid={4},jFrames={5}",
281 // m_controllingPrim.LocalID, m_velocityMotor.CurrentValue, realVelocityZ, m_controllingPrim.Flying, m_controllingPrim.IsColliding, m_jumpFrames);
297 282
298 //Alicia: Maintain minimum height when flying. 283 //Alicia: Maintain minimum height when flying.
299 // SL has a flying effect that keeps the avatar flying above the ground by some margin 284 // SL has a flying effect that keeps the avatar flying above the ground by some margin
@@ -304,6 +289,8 @@ public class BSActorAvatarMove : BSActor
304 289
305 if( m_controllingPrim.Position.Z < hover_height) 290 if( m_controllingPrim.Position.Z < hover_height)
306 { 291 {
292 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,addingUpforceForGroundMargin,height={1},hoverHeight={2}",
293 m_controllingPrim.LocalID, m_controllingPrim.Position.Z, hover_height);
307 stepVelocity.Z += BSParam.AvatarFlyingGroundUpForce; 294 stepVelocity.Z += BSParam.AvatarFlyingGroundUpForce;
308 } 295 }
309 } 296 }
@@ -328,11 +315,7 @@ public class BSActorAvatarMove : BSActor
328 if (m_controllingPrim.IsStationary) 315 if (m_controllingPrim.IsStationary)
329 { 316 {
330 entprop.Position = m_controllingPrim.RawPosition; 317 entprop.Position = m_controllingPrim.RawPosition;
331 // Suppress small movement velocity 318 entprop.Velocity = OMV.Vector3.Zero;
332 if (entprop.Velocity.LengthSquared() < BSParam.AvatarStopZeroThresholdSquared) {
333 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,OnPreUpdate,zeroing velocity={1}", m_controllingPrim.LocalID, entprop.Velocity);
334 entprop.Velocity = OMV.Vector3.Zero;
335 }
336 m_physicsScene.PE.SetTranslation(m_controllingPrim.PhysBody, entprop.Position, entprop.Rotation); 319 m_physicsScene.PE.SetTranslation(m_controllingPrim.PhysBody, entprop.Position, entprop.Rotation);
337 } 320 }
338 321
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..6d5589f 100644
--- a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs
@@ -89,6 +89,7 @@ public sealed class BSCharacter : BSPhysObject
89 _buoyancy = ComputeBuoyancyFromFlying(isFlying); 89 _buoyancy = ComputeBuoyancyFromFlying(isFlying);
90 Friction = BSParam.AvatarStandingFriction; 90 Friction = BSParam.AvatarStandingFriction;
91 Density = BSParam.AvatarDensity; 91 Density = BSParam.AvatarDensity;
92 _isPhysical = true;
92 93
93 // Old versions of ScenePresence passed only the height. If width and/or depth are zero, 94 // Old versions of ScenePresence passed only the height. If width and/or depth are zero,
94 // replace with the default values. 95 // replace with the default values.
@@ -457,7 +458,7 @@ public sealed class BSCharacter : BSPhysObject
457 get { return RawVelocity; } 458 get { return RawVelocity; }
458 set { 459 set {
459 RawVelocity = value; 460 RawVelocity = value;
460 OMV.Vector3 vel = RawVelocity; 461 OMV.Vector3 vel = RawVelocity;
461 462
462 DetailLog("{0}: set Velocity = {1}", LocalID, value); 463 DetailLog("{0}: set Velocity = {1}", LocalID, value);
463 464
@@ -662,10 +663,10 @@ public sealed class BSCharacter : BSPhysObject
662 addForce *= Mass * BSParam.AvatarAddForcePushFactor; 663 addForce *= Mass * BSParam.AvatarAddForcePushFactor;
663 664
664 DetailLog("{0},BSCharacter.addForce,call,force={1},addForce={2},push={3},mass={4}", LocalID, force, addForce, pushforce, Mass); 665 DetailLog("{0},BSCharacter.addForce,call,force={1},addForce={2},push={3},mass={4}", LocalID, force, addForce, pushforce, Mass);
665 AddForce(addForce, pushforce, false); 666 AddForce(false, addForce);
666 } 667 }
667 668
668 public override void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { 669 public override void AddForce(bool inTaintTime, OMV.Vector3 force) {
669 if (force.IsFinite()) 670 if (force.IsFinite())
670 { 671 {
671 OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); 672 OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude);
@@ -683,6 +684,10 @@ public sealed class BSCharacter : BSPhysObject
683 PhysScene.PE.ApplyCentralForce(PhysBody, addForce); 684 PhysScene.PE.ApplyCentralForce(PhysBody, addForce);
684 PhysScene.PE.Activate(PhysBody, true); 685 PhysScene.PE.Activate(PhysBody, true);
685 } 686 }
687 if (m_moveActor != null)
688 {
689 m_moveActor.SuppressStationayCheckUntilLowVelocity();
690 }
686 }); 691 });
687 } 692 }
688 else 693 else
@@ -692,7 +697,7 @@ public sealed class BSCharacter : BSPhysObject
692 } 697 }
693 } 698 }
694 699
695 public override void AddAngularForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { 700 public override void AddAngularForce(bool inTaintTime, OMV.Vector3 force) {
696 } 701 }
697 public override void SetMomentum(OMV.Vector3 momentum) { 702 public override void SetMomentum(OMV.Vector3 momentum) {
698 } 703 }
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/BSParam.cs b/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs
index aea69d7..389a441 100755
--- a/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs
@@ -633,7 +633,7 @@ public static class BSParam
633 new ParameterDefn<float>("AvatarAddForcePushFactor", "BSCharacter.AddForce is multiplied by this and mass to be like other physics engines", 633 new ParameterDefn<float>("AvatarAddForcePushFactor", "BSCharacter.AddForce is multiplied by this and mass to be like other physics engines",
634 0.315f ), 634 0.315f ),
635 new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped", 635 new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped",
636 0.1f, 636 0.4f,
637 (s) => { return (float)AvatarStopZeroThreshold; }, 637 (s) => { return (float)AvatarStopZeroThreshold; },
638 (s,v) => { AvatarStopZeroThreshold = v; AvatarStopZeroThresholdSquared = v * v; } ), 638 (s,v) => { AvatarStopZeroThreshold = v; AvatarStopZeroThresholdSquared = v * v; } ),
639 new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", 639 new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground",
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
index b50e4cc..a70d1b8 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
@@ -505,17 +505,20 @@ public abstract class BSPhysObject : PhysicsActor
505 // Collision sound requires a velocity to know it should happen. This is a lot of computation for a little used feature. 505 // Collision sound requires a velocity to know it should happen. This is a lot of computation for a little used feature.
506 OMV.Vector3 relvel = OMV.Vector3.Zero; 506 OMV.Vector3 relvel = OMV.Vector3.Zero;
507 if (IsPhysical) 507 if (IsPhysical)
508 relvel = Velocity; 508 relvel = RawVelocity;
509 if (collidee != null && collidee.IsPhysical) 509 if (collidee != null && collidee.IsPhysical)
510 relvel -= collidee.Velocity; 510 relvel -= collidee.RawVelocity;
511 newContact.RelativeSpeed = OMV.Vector3.Dot(relvel, contactNormal); 511 newContact.RelativeSpeed = OMV.Vector3.Dot(relvel, contactNormal);
512 // DetailLog("{0},{1}.Collision.AddCollider,vel={2},contee.vel={3},relvel={4},relspeed={5}",
513 // LocalID, TypeName, RawVelocity, (collidee == null ? OMV.Vector3.Zero : collidee.RawVelocity), relvel, newContact.RelativeSpeed);
512 514
513 lock (PhysScene.CollisionLock) 515 lock (PhysScene.CollisionLock)
514 { 516 {
515 CollisionCollection.AddCollider(collideeLocalID, newContact); 517 CollisionCollection.AddCollider(collideeLocalID, newContact);
516 } 518 }
517 DetailLog("{0},{1}.Collision.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}", 519 DetailLog("{0},{1}.Collision.AddCollider,call,with={2},point={3},normal={4},depth={5},speed={6},colliderMoving={7}",
518 LocalID, TypeName, collideeLocalID, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving); 520 LocalID, TypeName, collideeLocalID, contactPoint, contactNormal, pentrationDepth,
521 newContact.RelativeSpeed, ColliderIsMoving);
519 522
520 ret = true; 523 ret = true;
521 } 524 }
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 {