diff options
author | Teravus Ovares | 2009-04-07 15:01:46 +0000 |
---|---|---|
committer | Teravus Ovares | 2009-04-07 15:01:46 +0000 |
commit | 11f8ea30f9ead02a2d3d0342818fb7d931a36ecd (patch) | |
tree | c155616befc4e8e5692a92afc56172ef623220e6 /OpenSim/Region/Physics | |
parent | Thanks Ewe Loon for Mantis #3007 - llAngleBetween is producing numbers greate... (diff) | |
download | opensim-SC_OLD-11f8ea30f9ead02a2d3d0342818fb7d931a36ecd.zip opensim-SC_OLD-11f8ea30f9ead02a2d3d0342818fb7d931a36ecd.tar.gz opensim-SC_OLD-11f8ea30f9ead02a2d3d0342818fb7d931a36ecd.tar.bz2 opensim-SC_OLD-11f8ea30f9ead02a2d3d0342818fb7d931a36ecd.tar.xz |
* Tweak the BulletDotNETPlugin character controller so it feels more finished.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETCharacter.cs | 21 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs | 2 |
2 files changed, 20 insertions, 3 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; |
diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs index b04c96e..49a16a0 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETScene.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin | |||
68 | public float geomDefaultDensity = 10.000006836f; | 68 | public float geomDefaultDensity = 10.000006836f; |
69 | 69 | ||
70 | private float avPIDD = 65f; | 70 | private float avPIDD = 65f; |
71 | private float avPIDP = 28f; | 71 | private float avPIDP = 21f; |
72 | private float avCapRadius = 0.37f; | 72 | private float avCapRadius = 0.37f; |
73 | private float avStandupTensor = 2000000f; | 73 | private float avStandupTensor = 2000000f; |
74 | private float avDensity = 80f; | 74 | private float avDensity = 80f; |