* Get rid of the phenomena where the avatar sometimes reverts to the stand animation when flying across borders

* Applies to both standalone and grid mode
* The slight retardation on border cross remains - this is a separate issue
0.6.1-post-fixes
Justin Clarke Casey 2008-11-26 16:56:57 +00:00
parent 1767100316
commit 7c2f8e2ee9
3 changed files with 35 additions and 7 deletions

View File

@ -664,6 +664,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
info = packet.Type.ToString(); info = packet.Type.ToString();
} }
Console.WriteLine(m_circuitCode + ":" + direction + ": " + info); Console.WriteLine(m_circuitCode + ":" + direction + ": " + info);
} }
} }
@ -2236,6 +2237,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId) public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId)
{ {
//m_log.DebugFormat("[CLIENT]: Sending animations to {0}", Name);
AvatarAnimationPacket ani = (AvatarAnimationPacket)PacketPool.Instance.GetPacket(PacketType.AvatarAnimation); AvatarAnimationPacket ani = (AvatarAnimationPacket)PacketPool.Instance.GetPacket(PacketType.AvatarAnimation);
// TODO: don't create new blocks if recycling an old packet // TODO: don't create new blocks if recycling an old packet
ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1];
@ -2339,6 +2342,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
loc.Index = ib; loc.Index = ib;
loc.Header.Reliable = false; loc.Header.Reliable = false;
loc.Header.Zerocoded = true; loc.Header.Zerocoded = true;
OutPacket(loc, ThrottleOutPacketType.Task); OutPacket(loc, ThrottleOutPacketType.Task);
} }

View File

@ -87,7 +87,7 @@ namespace OpenSim.Region.Environment.Scenes
protected Vector3 m_rotationalvelocity; protected Vector3 m_rotationalvelocity;
/// <summary> /// <summary>
/// /// Current velocity of the entity.
/// </summary> /// </summary>
public virtual Vector3 Velocity public virtual Vector3 Velocity
{ {

View File

@ -402,12 +402,12 @@ namespace OpenSim.Region.Environment.Scenes
} }
m_pos = value; m_pos = value;
m_parentPosition=new Vector3(0, 0, 0); m_parentPosition = new Vector3(0, 0, 0);
} }
} }
/// <summary> /// <summary>
/// Current Velocity of the avatar. /// Current velocity of the avatar.
/// </summary> /// </summary>
public override Vector3 Velocity public override Vector3 Velocity
{ {
@ -424,6 +424,8 @@ namespace OpenSim.Region.Environment.Scenes
} }
set set
{ {
//m_log.DebugFormat("In {0} setting velocity of {1} to {2}", m_scene.RegionInfo.RegionName, Name, value);
if (m_physicsActor != null) if (m_physicsActor != null)
{ {
try try
@ -777,7 +779,11 @@ namespace OpenSim.Region.Environment.Scenes
AddToPhysicalScene(); AddToPhysicalScene();
m_physicsActor.Flying = isFlying; m_physicsActor.Flying = isFlying;
SendAnimPack();
// Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
// avatar to return to the standing position in mid-air. On login it looks like this is being sent
// elsewhere anyway
//SendAnimPack();
m_scene.SwapRootAgentCount(false); m_scene.SwapRootAgentCount(false);
m_scene.CommsManager.UserProfileCacheService.RequestInventoryForUser(m_uuid); m_scene.CommsManager.UserProfileCacheService.RequestInventoryForUser(m_uuid);
@ -806,12 +812,14 @@ namespace OpenSim.Region.Environment.Scenes
// "[SCENEPRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", // "[SCENEPRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}",
// Name, UUID, m_scene.RegionInfo.RegionName); // Name, UUID, m_scene.RegionInfo.RegionName);
Velocity = new Vector3(0, 0, 0); // Don't zero out the velocity since this can cause problems when an avatar is making a region crossing,
// depending on the exact timing. This shouldn't matter anyway since child agent positions are not updated.
//Velocity = new Vector3(0, 0, 0);
m_isChildAgent = true; m_isChildAgent = true;
m_scene.SwapRootAgentCount(true); m_scene.SwapRootAgentCount(true);
RemoveFromPhysicalScene(); RemoveFromPhysicalScene();
m_scene.EventManager.TriggerOnMakeChildAgent(this); m_scene.EventManager.TriggerOnMakeChildAgent(this);
//this.Pos = new Vector3(128, 128, 70);
} }
/// <summary> /// <summary>
@ -1045,11 +1053,13 @@ namespace OpenSim.Region.Environment.Scenes
bool oldflying = PhysicsActor.Flying; bool oldflying = PhysicsActor.Flying;
PhysicsActor.Flying = ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); PhysicsActor.Flying = ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
if (PhysicsActor.Flying != oldflying) if (PhysicsActor.Flying != oldflying)
{ {
update_movementflag = true; update_movementflag = true;
} }
} }
if (q != m_bodyRot) if (q != m_bodyRot)
{ {
m_bodyRot = q; m_bodyRot = q;
@ -1071,6 +1081,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
// Why did I get this? // Why did I get this?
} }
if ((m_movementflag & (uint) DCF) == 0) if ((m_movementflag & (uint) DCF) == 0)
{ {
m_movementflag += (byte) (uint) DCF; m_movementflag += (byte) (uint) DCF;
@ -1088,6 +1099,7 @@ namespace OpenSim.Region.Environment.Scenes
i++; i++;
} }
} }
// Cause the avatar to stop flying if it's colliding // Cause the avatar to stop flying if it's colliding
// with something with the down arrow pressed. // with something with the down arrow pressed.
@ -1109,6 +1121,10 @@ namespace OpenSim.Region.Environment.Scenes
if (update_movementflag || (update_rotation && DCFlagKeyPressed)) if (update_movementflag || (update_rotation && DCFlagKeyPressed))
{ {
// m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed));
// m_log.DebugFormat(
// "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
AddNewMovement(agent_control_v3, q); AddNewMovement(agent_control_v3, q);
if (update_movementflag) if (update_movementflag)
@ -1563,6 +1579,8 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
protected void TrySetMovementAnimation(string anim) protected void TrySetMovementAnimation(string anim)
{ {
//m_log.DebugFormat("Updating movement animation to {0}", anim);
if (m_animations.TrySetDefaultAnimation(anim, m_controllingClient.NextAnimationSequenceNumber)) if (m_animations.TrySetDefaultAnimation(anim, m_controllingClient.NextAnimationSequenceNumber))
{ {
SendAnimPack(); SendAnimPack();
@ -1638,9 +1656,13 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
/// <summary>
/// Update the movement animation of this avatar according to its current state
/// </summary>
protected void UpdateMovementAnimations() protected void UpdateMovementAnimations()
{ {
TrySetMovementAnimation(GetMovementAnimation()); string animation = GetMovementAnimation();
TrySetMovementAnimation(animation);
} }
/// <summary> /// <summary>
@ -2040,6 +2062,8 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void SendAnimPack() public void SendAnimPack()
{ {
//m_log.Debug("Sending animation pack");
if (m_isChildAgent) if (m_isChildAgent)
return; return;