From 16814dd8f18b51f5dd8841ae341847e117bb83b3 Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Thu, 2 Sep 2010 21:51:19 +0000 Subject: Fixes to JUMP system. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 66 ++++++++++++++++-------- 1 file changed, 44 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cd80eb0..f682ee5 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1471,6 +1471,9 @@ namespace OpenSim.Region.Framework.Scenes if (actor.Flying != oldflying) update_movementflag = true; + if (m_animator.m_jumping) // add for jumping + update_movementflag = true; + if (q != m_bodyRot) { m_bodyRot = q; @@ -2580,6 +2583,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.Info("[AGENT]: Stop FLying"); //} } + /* This jumping section removed to SPA else if (!actor.Flying && actor.IsColliding) { if (direc.Z > 2.0f) @@ -2592,12 +2596,12 @@ namespace OpenSim.Region.Framework.Scenes { direc.Z *= 0.1f; // prejump } - /* Animations are controlled via GetMovementAnimation() in ScenePresenceAnimator.cs + / * Animations are controlled via GetMovementAnimation() in ScenePresenceAnimator.cs Animator.TrySetMovementAnimation("PREJUMP"); Animator.TrySetMovementAnimation("JUMP"); - */ + * / } - } + } */ } // TODO: Add the force instead of only setting it to support multiple forces per frame? @@ -3543,28 +3547,46 @@ namespace OpenSim.Region.Framework.Scenes /// public override void UpdateMovement() { - if (m_forceToApply.HasValue) - { + if (Animator!=null) // add for jumping + { // add for jumping + // if (!m_animator.m_jumping) // add for jumping + // { // add for jumping - Vector3 force = m_forceToApply.Value; - m_updateflag = true; - Velocity = force; + if (m_forceToApply.HasValue) // this section realigned + { - m_forceToApply = null; - } - else - { - if (m_isNudging) - { - Vector3 force = Vector3.Zero; + Vector3 force = m_forceToApply.Value; + m_updateflag = true; +if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for jumping + Velocity = force; +//Console.WriteLine("UM1 {0}", Velocity); + m_forceToApply = null; + } + else + { + if (m_isNudging) + { + Vector3 force = Vector3.Zero; + + m_updateflag = true; +if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for jumping + Velocity = force; +//Console.WriteLine("UM2 {0}", Velocity); + m_isNudging = false; + m_updateCount = UPDATE_COUNT; //KF: Update anims to pickup "STAND" + } + else // add for jumping + { // add for jumping + Vector3 force = Vector3.Zero; // add for jumping +if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for jumping +//Console.WriteLine("UM3 {0}", Velocity); + Velocity = force; // add for jumping + } - m_updateflag = true; - Velocity = force; - m_isNudging = false; - m_updateCount = UPDATE_COUNT; //KF: Update anims to pickup "STAND" - } - } - } + } + // } // end realign + } // add for jumping + } // add for jumping /// /// Adds a physical representation of the avatar to the Physics plugin -- cgit v1.1