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.bulletsim
parent
951ffad81e
commit
4402851b08
|
@ -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();
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -95,11 +95,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
// }
|
||||
}
|
||||
|
||||
// FIXME: This doesn't work
|
||||
if (presence.PhysicsActor.Flying)
|
||||
presence.Animator.TrySetMovementAnimation("HOVER");
|
||||
else
|
||||
presence.Animator.TrySetMovementAnimation("STAND");
|
||||
// m_log.DebugFormat(
|
||||
// "[NPC MODULE]: AgentControlFlags {0}, MovementFlag {1} for {2}",
|
||||
// presence.AgentControlFlags, presence.MovementFlag, presence.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -131,6 +131,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
|||
double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
|
||||
Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move");
|
||||
Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos));
|
||||
Assert.That(npc.AgentControlFlags, Is.EqualTo((uint)AgentManager.ControlFlags.NONE));
|
||||
|
||||
// Try a second movement
|
||||
startPos = npc.AbsolutePosition;
|
||||
|
|
|
@ -870,7 +870,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
ScenePresence target = (ScenePresence)World.Entities[avatarID];
|
||||
if (target != null)
|
||||
{
|
||||
UUID animID=UUID.Zero;
|
||||
UUID animID = UUID.Zero;
|
||||
lock (m_host.TaskInventory)
|
||||
{
|
||||
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||
|
|
Loading…
Reference in New Issue