aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-07-18 18:13:38 +0100
committerJustin Clark-Casey2014-08-02 00:55:01 +0100
commit19bd27071a05513584d977104a57e562f2a63232 (patch)
treed00f5de2fd396686b8d6bef9329370a19b3dc5e3
parentWith ODE physics, fix an issue where the avatar couldn't jump and then move f... (diff)
downloadopensim-SC_OLD-19bd27071a05513584d977104a57e562f2a63232.zip
opensim-SC_OLD-19bd27071a05513584d977104a57e562f2a63232.tar.gz
opensim-SC_OLD-19bd27071a05513584d977104a57e562f2a63232.tar.bz2
opensim-SC_OLD-19bd27071a05513584d977104a57e562f2a63232.tar.xz
refactor: slightly adjust some code in ODECharacter.Move() to eliminate a condition check without changing the logic
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs37
1 files changed, 19 insertions, 18 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 2fac33f..7df74f3 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -890,29 +890,30 @@ namespace OpenSim.Region.Physics.OdePlugin
890// vec, _target_velocity, movementdivisor, vel); 890// vec, _target_velocity, movementdivisor, vel);
891 } 891 }
892 892
893 if (m_iscolliding && !flying && _target_velocity.Z > 0.0f)
894 {
895 // We're colliding with something and we're not flying but we're moving
896 // This means we're walking or running.
897 d.Vector3 pos = d.BodyGetPosition(Body);
898 vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P;
899 vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
900 vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
901 }
902 else if (!m_iscolliding && !flying)
903 {
904 // we're not colliding and we're not flying so that means we're falling!
905 // m_iscolliding includes collisions with the ground.
906
907 vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
908 vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
909 }
910
911 if (flying) 893 if (flying)
912 { 894 {
913 // This also acts as anti-gravity so that we hover when flying rather than fall. 895 // This also acts as anti-gravity so that we hover when flying rather than fall.
914 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D); 896 vec.Z = (_target_velocity.Z - vel.Z) * (PID_D);
915 } 897 }
898 else
899 {
900 if (m_iscolliding && _target_velocity.Z > 0.0f)
901 {
902 // We're colliding with something and we're not flying but we're moving
903 // This means we're walking or running.
904 d.Vector3 pos = d.BodyGetPosition(Body);
905 vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P;
906 vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
907 vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
908 }
909 else if (!m_iscolliding)
910 {
911 // we're not colliding and we're not flying so that means we're falling!
912 // m_iscolliding includes collisions with the ground.
913 vec.X = ((_target_velocity.X - vel.X) / 1.2f) * PID_D;
914 vec.Y = ((_target_velocity.Y - vel.Y) / 1.2f) * PID_D;
915 }
916 }
916 } 917 }
917 918
918 if (flying) 919 if (flying)