Fix up the animator and ScenePresence to like each other again

avinationmerge
Melanie 2011-10-20 23:11:53 +02:00
parent 35def547f7
commit fd0e65b0b1
2 changed files with 24 additions and 7 deletions

View File

@ -42,7 +42,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// </summary>
public class ScenePresenceAnimator
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public AnimationSet Animations
{
@ -181,8 +181,8 @@ TrySetMovementAnimation("STAND");
bool heldBack = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG);
bool heldLeft = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS);
bool heldRight = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG);
bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT;
bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT;
//bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT;
//bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT;
bool heldUp = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) == AgentManager.ControlFlags.AGENT_CONTROL_UP_POS;
bool heldDown = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG;
//bool flying = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) == AgentManager.ControlFlags.AGENT_CONTROL_FLY;
@ -413,10 +413,10 @@ TrySetMovementAnimation("STAND");
// Not walking
if (move.Z < 0)
return "CROUCH";
else if (heldTurnLeft)
return "TURNLEFT";
else if (heldTurnRight)
return "TURNRIGHT";
// else if (heldTurnLeft)
// return "TURNLEFT";
// else if (heldTurnRight)
// return "TURNRIGHT";
else
return "STAND";
}

View File

@ -2703,6 +2703,19 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 direc = vec * Rotation;
direc.Normalize();
if (PhysicsActor.Flying != m_flyingOld) // add for fly velocity control
{
m_flyingOld = PhysicsActor.Flying; // add for fly velocity control
if (!PhysicsActor.Flying)
m_wasFlying = true; // add for fly velocity control
}
if (PhysicsActor.IsColliding == true)
m_wasFlying = false; // add for fly velocity control
if ((vec.Z == 0f) && !PhysicsActor.Flying)
direc.Z = 0f; // Prevent camera WASD up.
direc *= 0.03f * 128f * SpeedModifier;
if (PhysicsActor != null)
@ -2721,6 +2734,10 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.Info("[AGENT]: Stop Flying");
//}
}
if (Animator.m_falling && m_wasFlying) // if falling from flying, disable motion add
{
direc *= 0.0f;
}
else if (!PhysicsActor.Flying && PhysicsActor.IsColliding)
{
if (direc.Z > 2.0f)