diff options
author | Kitto Flora | 2010-05-07 14:12:07 -0400 |
---|---|---|
committer | Kitto Flora | 2010-05-07 14:12:07 -0400 |
commit | add7abc1de2fce8db4c6d01cc4b5305bafa4bd87 (patch) | |
tree | 0702163cbc70db84315787c8caa98671b570df1a /OpenSim/Region/Physics/ChOdePlugin | |
parent | Fix Av jump motion S/W (diff) | |
download | opensim-SC-add7abc1de2fce8db4c6d01cc4b5305bafa4bd87.zip opensim-SC-add7abc1de2fce8db4c6d01cc4b5305bafa4bd87.tar.gz opensim-SC-add7abc1de2fce8db4c6d01cc4b5305bafa4bd87.tar.bz2 opensim-SC-add7abc1de2fce8db4c6d01cc4b5305bafa4bd87.tar.xz |
Fix Mouse+WASD makes Av rise; Fix PREJUMP.
Diffstat (limited to 'OpenSim/Region/Physics/ChOdePlugin')
-rw-r--r-- | OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs index 7a5093b..38c38b6 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs | |||
@@ -142,7 +142,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
142 | // unique UUID of this character object | 142 | // unique UUID of this character object |
143 | public UUID m_uuid; | 143 | public UUID m_uuid; |
144 | public bool bad = false; | 144 | public bool bad = false; |
145 | 145 | ||
146 | public OdeCharacter(String avName, OdeScene parent_scene, Vector3 pos, CollisionLocker dode, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) | 146 | public OdeCharacter(String avName, OdeScene parent_scene, Vector3 pos, CollisionLocker dode, Vector3 size, float pid_d, float pid_p, float capsule_radius, float tensor, float density, float height_fudge_factor, float walk_divisor, float rundivisor) |
147 | { | 147 | { |
148 | m_uuid = UUID.Random(); | 148 | m_uuid = UUID.Random(); |
@@ -892,7 +892,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
892 | 892 | ||
893 | // If the PID Controller isn't active then we set our force | 893 | // If the PID Controller isn't active then we set our force |
894 | // calculating base velocity to the current position | 894 | // calculating base velocity to the current position |
895 | 895 | ||
896 | if (Body == IntPtr.Zero) | 896 | if (Body == IntPtr.Zero) |
897 | return; | 897 | return; |
898 | 898 | ||
@@ -972,8 +972,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
972 | // Prim to avatar collisions | 972 | // Prim to avatar collisions |
973 | 973 | ||
974 | d.Vector3 pos = d.BodyGetPosition(Body); | 974 | d.Vector3 pos = d.BodyGetPosition(Body); |
975 | vec.X = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2); | 975 | float errX = _zeroPosition.X - pos.X; |
976 | vec.Y = (_target_velocity.Y - vel.Y)*(PID_D) + (_zeroPosition.Y - pos.Y)* (PID_P * 2); | 976 | float errY = _zeroPosition.Y - pos.Y; |
977 | if( (Math.Abs(errX) > 0.1f) || (Math.Abs(errY) > 0.1f) ) | ||
978 | { | ||
979 | vec.X = (_target_velocity.X - vel.X) * (PID_D) + (errX) * (PID_P * 2); | ||
980 | vec.Y = (_target_velocity.Y - vel.Y) * (PID_D) + (errY) * (PID_P * 2); | ||
981 | } | ||
982 | else | ||
983 | { // close, jump to lateral destination | ||
984 | d.BodySetPosition(Body, _zeroPosition.X, _zeroPosition.Y, pos.Z); | ||
985 | } | ||
977 | if (flying) | 986 | if (flying) |
978 | { | 987 | { |
979 | vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; | 988 | vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; |
@@ -1056,11 +1065,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1056 | } | 1065 | } |
1057 | if (vec.IsFinite()) | 1066 | if (vec.IsFinite()) |
1058 | { | 1067 | { |
1059 | doForce(vec); | 1068 | if (!vec.ApproxEquals(Vector3.Zero, 0.01f)) |
1060 | if (!_zeroFlag) | 1069 | { |
1061 | { | 1070 | doForce(vec); |
1062 | AlignAvatarTiltWithCurrentDirectionOfMovement(vec); | 1071 | if (!_zeroFlag) |
1063 | } | 1072 | { |
1073 | AlignAvatarTiltWithCurrentDirectionOfMovement(vec); | ||
1074 | } | ||
1075 | } | ||
1064 | } | 1076 | } |
1065 | else | 1077 | else |
1066 | { | 1078 | { |