diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index bea34d4..e912997 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | |||
@@ -1045,12 +1045,37 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1045 | if (me == midbox) | 1045 | if (me == midbox) |
1046 | { | 1046 | { |
1047 | if (Math.Abs(contact.normal.Z) > 0.95f) | 1047 | if (Math.Abs(contact.normal.Z) > 0.95f) |
1048 | { | ||
1048 | offset.Z = contact.pos.Z - _position.Z; | 1049 | offset.Z = contact.pos.Z - _position.Z; |
1050 | offset.X = (float)Math.Abs(offset.X) * 0.5f + contact.depth; | ||
1051 | offset.Y = (float)Math.Abs(offset.Y) * 0.5f + contact.depth; | ||
1052 | offset.Z = (float)Math.Abs(offset.Z) * 0.5f + contact.depth; | ||
1053 | |||
1054 | if (reverse) | ||
1055 | { | ||
1056 | offset.X *= -contact.normal.X; | ||
1057 | offset.Y *= -contact.normal.Y; | ||
1058 | offset.Z *= -contact.normal.Z; | ||
1059 | } | ||
1060 | else | ||
1061 | { | ||
1062 | offset.X *= contact.normal.X; | ||
1063 | offset.Y *= contact.normal.Y; | ||
1064 | offset.Z *= contact.normal.Z; | ||
1065 | } | ||
1066 | |||
1067 | offset.X += contact.pos.X; | ||
1068 | offset.Y += contact.pos.Y; | ||
1069 | offset.Z += contact.pos.Z; | ||
1070 | _position = offset; | ||
1071 | return true; | ||
1072 | } | ||
1049 | else | 1073 | else |
1050 | offset.Z = contact.normal.Z; | 1074 | offset.Z = contact.normal.Z; |
1051 | 1075 | ||
1052 | offset.Normalize(); | 1076 | offset.Normalize(); |
1053 | 1077 | ||
1078 | /* | ||
1054 | if (reverse) | 1079 | if (reverse) |
1055 | { | 1080 | { |
1056 | contact.normal.X = offset.X; | 1081 | contact.normal.X = offset.X; |
@@ -1063,7 +1088,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1063 | contact.normal.Y = -offset.Y; | 1088 | contact.normal.Y = -offset.Y; |
1064 | contact.normal.Z = -offset.Z; | 1089 | contact.normal.Z = -offset.Z; |
1065 | } | 1090 | } |
1066 | 1091 | */ | |
1092 | //_position.Z = offset.Z; | ||
1067 | return true; | 1093 | return true; |
1068 | } | 1094 | } |
1069 | 1095 | ||
@@ -1071,8 +1097,20 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1071 | { | 1097 | { |
1072 | float h = contact.pos.Z - _position.Z; | 1098 | float h = contact.pos.Z - _position.Z; |
1073 | 1099 | ||
1100 | // Only do this if the normal is sufficiently pointing in the 'up' direction | ||
1074 | if (Math.Abs(contact.normal.Z) > 0.95f) | 1101 | if (Math.Abs(contact.normal.Z) > 0.95f) |
1075 | { | 1102 | { |
1103 | // We Only want to do this if we're sunk into the object a bit and we're stuck and we're trying to move and feetcollision is false | ||
1104 | if ((contact.depth > 0.0010f && _velocity.X == 0f && _velocity.Y == 0 && _velocity.Z == 0) | ||
1105 | && (_target_velocity.X > 0 || _target_velocity.Y > 0 || _target_velocity.Z > 0) | ||
1106 | && (!feetcollision) ) | ||
1107 | { | ||
1108 | m_collisionException = true; // Stop looping, do this only once not X times Contacts | ||
1109 | _position.Z += contact.depth + 0.01f; // Move us Up the amount that we sank in, and add 0.01 meters to gently lift avatar up. | ||
1110 | |||
1111 | return true; | ||
1112 | } | ||
1113 | |||
1076 | if (contact.normal.Z > 0) | 1114 | if (contact.normal.Z > 0) |
1077 | contact.normal.Z = 1.0f; | 1115 | contact.normal.Z = 1.0f; |
1078 | else | 1116 | else |