diff options
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs index 6906451..c6428b8 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | |||
@@ -150,6 +150,16 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
150 | return true; | 150 | return true; |
151 | } | 151 | } |
152 | 152 | ||
153 | private bool check_all_prims(POSCharacter c) | ||
154 | { | ||
155 | foreach (POSPrim p in _prims) | ||
156 | { | ||
157 | if (check_collision(c, p)) | ||
158 | return true; | ||
159 | } | ||
160 | return false; | ||
161 | } | ||
162 | |||
153 | public override void Simulate(float timeStep) | 163 | public override void Simulate(float timeStep) |
154 | { | 164 | { |
155 | foreach (POSCharacter character in _characters) | 165 | foreach (POSCharacter character in _characters) |
@@ -181,22 +191,28 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
181 | /// Completely Bogus Collision Detection!!! | 191 | /// Completely Bogus Collision Detection!!! |
182 | /// better known as the CBCD algorithm | 192 | /// better known as the CBCD algorithm |
183 | 193 | ||
184 | foreach (POSPrim p in _prims) | 194 | if (check_all_prims(character)) |
185 | { | 195 | { |
186 | if (check_collision(character, p)) | 196 | character.Position.Z = oldposZ; // first try Z axis |
197 | if (check_all_prims(character)) | ||
187 | { | 198 | { |
188 | character.Position.Z = oldposZ; // first try Z axis | 199 | character.Position.Z = oldposZ + 0.4f; // try harder |
189 | if (check_collision(character, p)) | 200 | if (check_all_prims(character)) |
190 | { | 201 | { |
191 | character.Position.X = oldposX; | 202 | character.Position.X = oldposX; |
192 | character.Position.Y = oldposY; | 203 | character.Position.Y = oldposY; |
204 | character.Position.Z = oldposZ; | ||
193 | } | 205 | } |
194 | else | 206 | else |
195 | { | 207 | { |
196 | character._target_velocity.Z = 0; | 208 | character._target_velocity.Z = 0; |
197 | } | 209 | } |
198 | } | 210 | } |
199 | } | 211 | else |
212 | { | ||
213 | character._target_velocity.Z = 0; | ||
214 | } | ||
215 | } | ||
200 | 216 | ||
201 | if (character.Position.Y < 0) | 217 | if (character.Position.Y < 0) |
202 | { | 218 | { |