diff options
author | Jeff Ames | 2007-11-18 18:20:02 +0000 |
---|---|---|
committer | Jeff Ames | 2007-11-18 18:20:02 +0000 |
commit | c40cfb01aa359471d1c81775fedee95814a14fbc (patch) | |
tree | dced43e155c81fe721730a8a5c1784c0d1056a18 | |
parent | * Tentative Bug fix for OptikSL's intermittant Copy prim error. (diff) | |
download | opensim-SC-c40cfb01aa359471d1c81775fedee95814a14fbc.zip opensim-SC-c40cfb01aa359471d1c81775fedee95814a14fbc.tar.gz opensim-SC-c40cfb01aa359471d1c81775fedee95814a14fbc.tar.bz2 opensim-SC-c40cfb01aa359471d1c81775fedee95814a14fbc.tar.xz |
flying in POS should be a bit smoother
-rw-r--r-- | OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs index 8e74b5f..2e0f2e3 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | |||
@@ -173,14 +173,14 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
173 | character._target_velocity.Z += gravity * timeStep; | 173 | character._target_velocity.Z += gravity * timeStep; |
174 | } | 174 | } |
175 | 175 | ||
176 | bool forcedZ = false; | ||
176 | character.Position.X = character.Position.X + (character._target_velocity.X * timeStep); | 177 | character.Position.X = character.Position.X + (character._target_velocity.X * timeStep); |
177 | character.Position.Y = character.Position.Y + (character._target_velocity.Y * timeStep); | 178 | character.Position.Y = character.Position.Y + (character._target_velocity.Y * timeStep); |
178 | float terrainheight = _heightMap[(int)character.Position.Y * 256 + (int)character.Position.X]; | 179 | float terrainheight = _heightMap[(int)character.Position.Y * 256 + (int)character.Position.X]; |
179 | if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2) | 180 | if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2) |
180 | { | 181 | { |
181 | character.Position.Z = terrainheight + 1.0f; | 182 | character.Position.Z = terrainheight + 1.0f; |
182 | character._target_velocity.Z = 0; | 183 | forcedZ = true; |
183 | character._velocity.Z = 0; | ||
184 | } | 184 | } |
185 | else | 185 | else |
186 | { | 186 | { |
@@ -205,12 +205,12 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
205 | } | 205 | } |
206 | else | 206 | else |
207 | { | 207 | { |
208 | character._target_velocity.Z = 0; | 208 | forcedZ = true; |
209 | } | 209 | } |
210 | } | 210 | } |
211 | else | 211 | else |
212 | { | 212 | { |
213 | character._target_velocity.Z = 0; | 213 | forcedZ = true; |
214 | } | 214 | } |
215 | } | 215 | } |
216 | 216 | ||
@@ -234,6 +234,17 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
234 | 234 | ||
235 | character._velocity.X = (character.Position.X - oldposX) / timeStep; | 235 | character._velocity.X = (character.Position.X - oldposX) / timeStep; |
236 | character._velocity.Y = (character.Position.Y - oldposY) / timeStep; | 236 | character._velocity.Y = (character.Position.Y - oldposY) / timeStep; |
237 | |||
238 | if (forcedZ) | ||
239 | { | ||
240 | character._velocity.Z = 0; | ||
241 | character._target_velocity.Z = 0; | ||
242 | character.RequestPhysicsterseUpdate(); | ||
243 | } | ||
244 | else | ||
245 | { | ||
246 | character._velocity.Z = (character.Position.Z - oldposZ) / timeStep; | ||
247 | } | ||
237 | } | 248 | } |
238 | } | 249 | } |
239 | 250 | ||