diff options
author | Melanie | 2010-05-08 14:17:43 +0100 |
---|---|---|
committer | Melanie | 2010-05-08 14:17:43 +0100 |
commit | 420dd78fb7f48c4d6645773992cc2da968529b15 (patch) | |
tree | 49ee8760c5c9ce6d28c3002fb6bf251e707546bf /OpenSim/Region/Physics/ChOdePlugin | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
parent | Merge branch 'master' of ssh://3dhosting.de/var/git/careminster (diff) | |
download | opensim-SC-420dd78fb7f48c4d6645773992cc2da968529b15.zip opensim-SC-420dd78fb7f48c4d6645773992cc2da968529b15.tar.gz opensim-SC-420dd78fb7f48c4d6645773992cc2da968529b15.tar.bz2 opensim-SC-420dd78fb7f48c4d6645773992cc2da968529b15.tar.xz |
Merge branch 'careminster' into careminster-presence-refactor
Diffstat (limited to '')
-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 | { |