diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs index bd3c7ac..ab9cc27 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs | |||
@@ -652,13 +652,16 @@ public sealed class BSCharacter : BSPhysObject | |||
652 | public override void AddForce(OMV.Vector3 force, bool pushforce) | 652 | public override void AddForce(OMV.Vector3 force, bool pushforce) |
653 | { | 653 | { |
654 | // Since this force is being applied in only one step, make this a force per second. | 654 | // Since this force is being applied in only one step, make this a force per second. |
655 | OMV.Vector3 addForce = force / PhysScene.LastTimeStep; | 655 | OMV.Vector3 addForce = force; |
656 | 656 | ||
657 | // compensate for density variation | 657 | // The interaction of this force with the simulator rate and collision occurance is tricky. |
658 | // with a adicional parameter to sync with old ode | 658 | // ODE multiplies the force by 100 |
659 | if(pushforce) | 659 | // ubODE multiplies the force by 5.3 |
660 | addForce = addForce * Density * BSParam.DensityScaleFactor * 0.08f;; | 660 | // BulletSim, after much in-world testing, thinks it gets a similar effect by multiplying mass*0.315f |
661 | // This number could be a feature of friction or timing, but it seems to move avatars the same as ubODE | ||
662 | addForce *= Mass * BSParam.AvatarAddForcePushFactor; | ||
661 | 663 | ||
664 | DetailLog("{0},BSCharacter.addForce,call,force={1},addForce={2},push={3},mass={4}", LocalID, force, addForce, pushforce, Mass); | ||
662 | AddForce(addForce, pushforce, false); | 665 | AddForce(addForce, pushforce, false); |
663 | } | 666 | } |
664 | 667 | ||
@@ -666,7 +669,7 @@ public sealed class BSCharacter : BSPhysObject | |||
666 | if (force.IsFinite()) | 669 | if (force.IsFinite()) |
667 | { | 670 | { |
668 | OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); | 671 | OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); |
669 | // DetailLog("{0},BSCharacter.addForce,call,force={1}", LocalID, addForce); | 672 | // DetailLog("{0},BSCharacter.addForce,call,force={1},push={2},inTaint={3}", LocalID, addForce, pushforce, inTaintTime); |
670 | 673 | ||
671 | PhysScene.TaintedObject(inTaintTime, LocalID, "BSCharacter.AddForce", delegate() | 674 | PhysScene.TaintedObject(inTaintTime, LocalID, "BSCharacter.AddForce", delegate() |
672 | { | 675 | { |
@@ -674,6 +677,9 @@ public sealed class BSCharacter : BSPhysObject | |||
674 | // DetailLog("{0},BSCharacter.addForce,taint,force={1}", LocalID, addForce); | 677 | // DetailLog("{0},BSCharacter.addForce,taint,force={1}", LocalID, addForce); |
675 | if (PhysBody.HasPhysicalBody) | 678 | if (PhysBody.HasPhysicalBody) |
676 | { | 679 | { |
680 | // Bullet adds this central force to the total force for this tick. | ||
681 | // Deep down in Bullet: | ||
682 | // linearVelocity += totalForce / mass * timeStep; | ||
677 | PhysScene.PE.ApplyCentralForce(PhysBody, addForce); | 683 | PhysScene.PE.ApplyCentralForce(PhysBody, addForce); |
678 | PhysScene.PE.Activate(PhysBody, true); | 684 | PhysScene.PE.Activate(PhysBody, true); |
679 | } | 685 | } |