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

@@ -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
{

View File

@@ -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;