aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorRobert Adams2012-12-27 06:56:36 -0800
committerRobert Adams2012-12-27 22:12:25 -0800
commite98e223927226602d7a050bbb92ebb2904e81562 (patch)
tree170f727223a811a0b14ca51744aa8efb6360dd0d /OpenSim/Region
parent* Merges BulletSim Updates to BulletSimN(BulletSNPlugin) (diff)
downloadopensim-SC_OLD-e98e223927226602d7a050bbb92ebb2904e81562.zip
opensim-SC_OLD-e98e223927226602d7a050bbb92ebb2904e81562.tar.gz
opensim-SC_OLD-e98e223927226602d7a050bbb92ebb2904e81562.tar.bz2
opensim-SC_OLD-e98e223927226602d7a050bbb92ebb2904e81562.tar.xz
BulletSim: complete applyImpulse function in BSCharacter (like I said
I did last time).
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs25
1 files changed, 17 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 9f0d5af..cbc1772 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -683,22 +683,31 @@ public sealed class BSCharacter : BSPhysObject
683 public override void AddForce(OMV.Vector3 force, bool pushforce) { 683 public override void AddForce(OMV.Vector3 force, bool pushforce) {
684 if (force.IsFinite()) 684 if (force.IsFinite())
685 { 685 {
686 _force.X += force.X; 686 float magnitude = force.Length();
687 _force.Y += force.Y; 687 if (magnitude > BSParam.MaxAddForceMagnitude)
688 _force.Z += force.Z; 688 {
689 // m_log.DebugFormat("{0}: AddForce. adding={1}, newForce={2}", LogHeader, force, _force); 689 // Force has a limit
690 force = force / magnitude * BSParam.MaxAddForceMagnitude;
691 }
692
693 OMV.Vector3 addForce = force / PhysicsScene.LastTimeStep;
694 DetailLog("{0},BSCharacter.addForce,call,force={1}", LocalID, addForce);
695
690 PhysicsScene.TaintedObject("BSCharacter.AddForce", delegate() 696 PhysicsScene.TaintedObject("BSCharacter.AddForce", delegate()
691 { 697 {
692 DetailLog("{0},BSCharacter.setAddForce,taint,addedForce={1}", LocalID, _force); 698 // Bullet adds this central force to the total force for this tick
699 DetailLog("{0},BSCharacter.addForce,taint,force={1}", LocalID, addForce);
693 if (PhysBody.HasPhysicalBody) 700 if (PhysBody.HasPhysicalBody)
694 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force); 701 {
702 BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, addForce);
703 }
695 }); 704 });
696 } 705 }
697 else 706 else
698 { 707 {
699 m_log.ErrorFormat("{0}: Got a NaN force applied to a Character", LogHeader); 708 m_log.WarnFormat("{0}: Got a NaN force applied to a character. LocalID={1}", LogHeader, LocalID);
709 return;
700 } 710 }
701 //m_lastUpdateSent = false;
702 } 711 }
703 712
704 public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { 713 public override void AddAngularForce(OMV.Vector3 force, bool pushforce) {