Get NPCs to revert to the correct 'resting' animation (e.g. stand or hover) after finishing their movement. This also fixes judder after an avatar has finished "go here"/autopilot movement in a viewer.

This meant reseting the SP.AgentControlFlags since the Animator uses these to determine the correct default animation.
This commit is contained in:
Justin Clark-Casey (justincc)
2011-08-11 01:56:42 +01:00
parent 951ffad81e
commit 4402851b08
5 changed files with 19 additions and 8 deletions

View File

@@ -77,6 +77,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (m_scenePresence.IsChildAgent)
return;
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name);
if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
SendAnimPack();
}
@@ -91,6 +93,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (animID == UUID.Zero)
return;
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", animID, name, m_scenePresence.Name);
AddAnimation(animID, objectID);
}
@@ -127,13 +131,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// </summary>
public void TrySetMovementAnimation(string anim)
{
//m_log.DebugFormat("Updating movement animation to {0}", anim);
if (!m_scenePresence.IsChildAgent)
{
if (m_animations.TrySetDefaultAnimation(
anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
{
// m_log.DebugFormat(
// "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}",
// anim, m_scenePresence.Name);
// 16384 is CHANGED_ANIMATION
m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION});
SendAnimPack();

View File

@@ -1745,6 +1745,12 @@ namespace OpenSim.Region.Framework.Scenes
MovingToTarget = false;
MoveToPositionTarget = Vector3.Zero;
// We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct
// resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag.
// However, the line is here rather than in the NPC module since it also appears necessary to stop a
// viewer that uses "go here" from juddering on all subsequent avatar movements.
AgentControlFlags = (uint)AgentManager.ControlFlags.NONE;
}
private void CheckAtSitTarget()