diff options
author | UbitUmarov | 2014-09-30 17:02:24 +0100 |
---|---|---|
committer | UbitUmarov | 2014-09-30 17:02:24 +0100 |
commit | b9be9097aab3fdb2b4a1f3373d253012f56814f0 (patch) | |
tree | 2ef2d818bd7ace6d8565df1906dd11bfce06189f | |
parent | persist script changes to mediaURL and musicURL ( heavy thing ) (diff) | |
download | opensim-SC-b9be9097aab3fdb2b4a1f3373d253012f56814f0.zip opensim-SC-b9be9097aab3fdb2b4a1f3373d253012f56814f0.tar.gz opensim-SC-b9be9097aab3fdb2b4a1f3373d253012f56814f0.tar.bz2 opensim-SC-b9be9097aab3fdb2b4a1f3373d253012f56814f0.tar.xz |
fix a incomplet landing handling case
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e6a366d..42d3684 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3241,12 +3241,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3241 | // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}", | 3241 | // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}", |
3242 | // vec, Rotation, thisAddSpeedModifier, Name); | 3242 | // vec, Rotation, thisAddSpeedModifier, Name); |
3243 | 3243 | ||
3244 | // rotate from avatar coord space to world | ||
3245 | // for now all controls assume this is only a rotation around Z | ||
3246 | // if not all checks below need to be done before this rotation | ||
3244 | Vector3 direc = vec * Rotation; | 3247 | Vector3 direc = vec * Rotation; |
3245 | direc.Normalize(); | 3248 | direc.Normalize(); |
3246 | 3249 | ||
3250 | // mouse look situation ? | ||
3247 | if ((vec.Z == 0f) && !Flying) | 3251 | if ((vec.Z == 0f) && !Flying) |
3248 | direc.Z = 0f; // Prevent camera WASD up. | 3252 | direc.Z = 0f; // Prevent camera WASD up. |
3249 | 3253 | ||
3254 | // odd rescalings | ||
3250 | direc *= 0.03f * 128f * SpeedModifier * thisAddSpeedModifier; | 3255 | direc *= 0.03f * 128f * SpeedModifier * thisAddSpeedModifier; |
3251 | 3256 | ||
3252 | // m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name); | 3257 | // m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name); |
@@ -3254,35 +3259,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
3254 | if (Animator.currentControlState == ScenePresenceAnimator.motionControlStates.falling) | 3259 | if (Animator.currentControlState == ScenePresenceAnimator.motionControlStates.falling) |
3255 | { | 3260 | { |
3256 | if (breaking) | 3261 | if (breaking) |
3257 | direc.Z = -9999f; //hack | 3262 | direc.Z = -9999f; //hack to tell physics to stop on Z |
3258 | else | 3263 | else |
3259 | direc = Vector3.Zero; | 3264 | direc = Vector3.Zero; |
3260 | } | 3265 | } |
3261 | else if (Flying) | 3266 | else if (Flying) |
3262 | { | 3267 | { |
3263 | if(IsColliding) | 3268 | if (IsColliding && direc.Z < 0) |
3269 | // landing situation, prevent avatar moving or it may fail to land | ||
3270 | // animator will handle this condition and do the land | ||
3264 | direc = Vector3.Zero; | 3271 | direc = Vector3.Zero; |
3265 | else | 3272 | else |
3266 | direc *= 4.0f; | 3273 | direc *= 4.0f; |
3267 | } | 3274 | } |
3268 | else if (IsColliding) | 3275 | else if (IsColliding) |
3269 | { | 3276 | { |
3270 | if (direc.Z > 2.0f) | 3277 | if (direc.Z > 2.0f) // reinforce jumps |
3271 | { | 3278 | { |
3272 | direc.Z *= 2.6f; | 3279 | direc.Z *= 2.6f; |
3273 | } | 3280 | } |
3274 | else if (direc.Z < 0) | 3281 | else if (direc.Z < 0) // on a surface moving down (pg down) only changes animation |
3275 | direc.Z = 0; | 3282 | direc.Z = 0; |
3276 | /* | ||
3277 | float c = CollisionPlane.Z; | ||
3278 | if (c > 0.2f && c < 0.94f && (direc.X != 0 || direc.Y != 0)) | ||
3279 | { | ||
3280 | float p = direc.X * CollisionPlane.X + direc.Y * CollisionPlane.Y; | ||
3281 | direc.X -= p * CollisionPlane.X; | ||
3282 | direc.Y -= p * CollisionPlane.Y; | ||
3283 | direc.Z -= p * c; | ||
3284 | } | ||
3285 | */ | ||
3286 | } | 3283 | } |
3287 | 3284 | ||
3288 | // m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name); | 3285 | // m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name); |