diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs index b66923a..03646e5 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs | |||
@@ -916,6 +916,11 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
916 | // we're in mid air suspended | 916 | // we're in mid air suspended |
917 | vec.X = ((m_target_velocity.X / movementdivisor) - vel.X) * (PID_D / 6); | 917 | vec.X = ((m_target_velocity.X / movementdivisor) - vel.X) * (PID_D / 6); |
918 | vec.Y = ((m_target_velocity.Y / movementdivisor) - vel.Y) * (PID_D / 6); | 918 | vec.Y = ((m_target_velocity.Y / movementdivisor) - vel.Y) * (PID_D / 6); |
919 | |||
920 | // We don't want linear velocity to cause our avatar to bounce, so we check target Z and actual velocity X, Y | ||
921 | // rebound preventing | ||
922 | if (m_target_velocity.Z < 0.025f && m_velocity.X < 0.25f && m_velocity.Y < 0.25f) | ||
923 | m_zeroFlag = true; | ||
919 | } | 924 | } |
920 | 925 | ||
921 | if (m_iscolliding && !m_flying && m_target_velocity.Z > 0.0f) | 926 | if (m_iscolliding && !m_flying && m_target_velocity.Z > 0.0f) |
@@ -957,7 +962,19 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
957 | } | 962 | } |
958 | if (m_flying) | 963 | if (m_flying) |
959 | { | 964 | { |
960 | //vec.Z += ((-1 * m_parent_scene.gravityz) * m_mass); | 965 | // Slight PID correction |
966 | vec.Z += (((-1 * m_parent_scene.gravityz) * m_mass) * 0.035f); | ||
967 | |||
968 | |||
969 | //auto fly height. Kitto Flora | ||
970 | //d.Vector3 pos = d.BodyGetPosition(Body); | ||
971 | float target_altitude = m_parent_scene.GetTerrainHeightAtXY(m_position.X, m_position.Y) + 5.0f; | ||
972 | |||
973 | if (m_position.Z < target_altitude) | ||
974 | { | ||
975 | vec.Z += (target_altitude - m_position.Z) * PID_P * 5.0f; | ||
976 | } | ||
977 | |||
961 | } | 978 | } |
962 | if (Body != null && (((m_target_velocity.X > 0.2f || m_target_velocity.X < -0.2f) || (m_target_velocity.Y > 0.2f || m_target_velocity.Y < -0.2f)))) | 979 | if (Body != null && (((m_target_velocity.X > 0.2f || m_target_velocity.X < -0.2f) || (m_target_velocity.Y > 0.2f || m_target_velocity.Y < -0.2f)))) |
963 | { | 980 | { |
@@ -1036,7 +1053,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
1036 | m_velocity.Y = (vec.Y); | 1053 | m_velocity.Y = (vec.Y); |
1037 | 1054 | ||
1038 | m_velocity.Z = (vec.Z); | 1055 | m_velocity.Z = (vec.Z); |
1039 | 1056 | //m_log.Debug(m_target_velocity); | |
1040 | if (m_velocity.Z < -6 && !m_hackSentFall) | 1057 | if (m_velocity.Z < -6 && !m_hackSentFall) |
1041 | { | 1058 | { |
1042 | m_hackSentFall = true; | 1059 | m_hackSentFall = true; |