From 7b0ca6ea30871e879cd0dce1a8ea07dd47a1dc31 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 19 May 2008 14:49:20 +0000 Subject: Attempt to fix incorrect animations when using ODE (bugs #1320 / #1321) --- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 25 ++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 8ad3de6..f7c9b8d 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -1178,13 +1178,21 @@ namespace OpenSim.Region.Environment.Scenes else if (PhysicsActor != null && (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0 && PhysicsActor.IsColliding) { - return "CROUCHWALK"; + if ((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0 || + (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) != 0) + { + return "CROUCHWALK"; + } + else + { + return "CROUCH"; + } } else if (PhysicsActor != null && !PhysicsActor.IsColliding && PhysicsActor.Velocity.Z < -6) { return "FALLDOWN"; } - else if (PhysicsActor != null && !PhysicsActor.IsColliding && Velocity.Z > 0 && + else if (PhysicsActor != null && !PhysicsActor.IsColliding && Velocity.Z > 1e-6 && (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) { return "JUMP"; @@ -1200,17 +1208,16 @@ namespace OpenSim.Region.Environment.Scenes } else { - // Not moving - if (PhysicsActor != null && PhysicsActor.IsColliding) - { - return "CROUCH"; - } - else if (PhysicsActor != null && !PhysicsActor.IsColliding && PhysicsActor.Velocity.Z < -6 && !PhysicsActor.Flying) + // We are not moving + if (PhysicsActor != null && !PhysicsActor.IsColliding && PhysicsActor.Velocity.Z < -6 && !PhysicsActor.Flying) { return "FALLDOWN"; } - else if (PhysicsActor != null && !PhysicsActor.IsColliding && Velocity.Z > 0 && !PhysicsActor.Flying) + else if (PhysicsActor != null && !PhysicsActor.IsColliding && Velocity.Z > 6 && !PhysicsActor.Flying) { + // HACK: We check if Velocity.Z > 6 for this animation in order to avoid false positives during normal movement. + // TODO: set this animation only when on the ground and UP_POS is received? + // This is the standing jump return "JUMP"; } -- cgit v1.1