Fixed animation sequencing: SitHere, Falling, Stand/Walk etc. Login Init

Av Animation at Stand.
avinationmerge
KittoFlora 2009-11-25 08:03:09 +01:00
parent 31827b0286
commit 32c464ad1f
2 changed files with 33 additions and 16 deletions

View File

@ -53,8 +53,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
{ {
get { return m_movementAnimation; } get { return m_movementAnimation; }
} }
protected string m_movementAnimation = "DEFAULT"; // protected string m_movementAnimation = "DEFAULT"; //KF: 'DEFAULT' does not exist!
protected string m_movementAnimation = "CROUCH"; //KF: CROUCH ensures reliable Av Anim. init.
private int m_animTickFall; private int m_animTickFall;
private int m_animTickJump; private int m_animTickJump;
@ -123,17 +123,22 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// </summary> /// </summary>
public void TrySetMovementAnimation(string anim) public void TrySetMovementAnimation(string anim)
{ {
//m_log.DebugFormat("Updating movement animation to {0}", anim); //Console.WriteLine("Updating movement animation to {0}", anim);
if (!m_scenePresence.IsChildAgent) if (!m_scenePresence.IsChildAgent)
{ {
if (m_animations.TrySetDefaultAnimation( if (m_animations.TrySetDefaultAnimation(
anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero)) anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero))
{ {
//Console.WriteLine("TSMA {0} success.", anim);
// 16384 is CHANGED_ANIMATION // 16384 is CHANGED_ANIMATION
m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 }); m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 });
SendAnimPack(); SendAnimPack();
} }
else
{
//Console.WriteLine("TSMA {0} fail.", anim);
}
} }
} }
@ -313,7 +318,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
public void UpdateMovementAnimations() public void UpdateMovementAnimations()
{ {
m_movementAnimation = GetMovementAnimation(); m_movementAnimation = GetMovementAnimation();
//Console.WriteLine("UMA got {0}", m_movementAnimation);
if (m_movementAnimation == "PREJUMP" && !m_scenePresence.Scene.m_usePreJump) if (m_movementAnimation == "PREJUMP" && !m_scenePresence.Scene.m_usePreJump)
{ {
// This was the previous behavior before PREJUMP // This was the previous behavior before PREJUMP
@ -445,4 +450,4 @@ namespace OpenSim.Region.Framework.Scenes.Animation
SendAnimPack(animIDs, sequenceNums, objectIDs); SendAnimPack(animIDs, sequenceNums, objectIDs);
} }
} }
} }

View File

@ -90,6 +90,7 @@ namespace OpenSim.Region.Framework.Scenes
/// issue #1716 /// issue #1716
/// </summary> /// </summary>
// private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f); // private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f);
// Value revised by KF 091121 by comparison with SL.
private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.418f); private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.418f);
public UUID currentParcelUUID = UUID.Zero; public UUID currentParcelUUID = UUID.Zero;
@ -205,6 +206,9 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_followCamAuto; private bool m_followCamAuto;
private int m_movementUpdateCount; private int m_movementUpdateCount;
private int m_lastColCount = -1; //KF: Look for Collision chnages
private int m_updateCount = 0; //KF: Update Anims for a while
private static readonly int UPDATE_COUNT = 10; // how many frames to update for
private const int NumMovementsBetweenRayCast = 5; private const int NumMovementsBetweenRayCast = 5;
@ -662,9 +666,7 @@ namespace OpenSim.Region.Framework.Scenes
AdjustKnownSeeds(); AdjustKnownSeeds();
// TODO: I think, this won't send anything, as we are still a child here... Animator.TrySetMovementAnimation("STAND");
Animator.TrySetMovementAnimation("STAND");
// we created a new ScenePresence (a new child agent) in a fresh region. // we created a new ScenePresence (a new child agent) in a fresh region.
// Request info about all the (root) agents in this region // Request info about all the (root) agents in this region
// Note: This won't send data *to* other clients in that region (children don't send) // Note: This won't send data *to* other clients in that region (children don't send)
@ -1018,7 +1020,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (1.56f / 6f)); AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (1.56f / 6f));
} }
m_updateCount = UPDATE_COUNT; //KF: Trigger Anim updates to catch falling anim.
ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient))); AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient)));
} }
@ -1266,9 +1270,7 @@ namespace OpenSim.Region.Framework.Scenes
if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0) if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0)
{ {
// TODO: This doesn't prevent the user from walking yet. m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.
// Setting parent ID would fix this, if we knew what value
// to use. Or we could add a m_isSitting variable.
Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
} }
@ -1926,7 +1928,6 @@ namespace OpenSim.Region.Framework.Scenes
public void SitAltitudeCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance) public void SitAltitudeCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance)
{ {
// Console.WriteLine("[RAYCASTRESULT]: Hit={0}, Point={1}, ID={2}, Dist={3}", hitYN, collisionPoint, localid, distance);
if(hitYN) if(hitYN)
{ {
// m_pos = Av offset from prim center to make look like on center // m_pos = Av offset from prim center to make look like on center
@ -2964,6 +2965,7 @@ namespace OpenSim.Region.Framework.Scenes
m_updateflag = true; m_updateflag = true;
Velocity = force; Velocity = force;
m_isNudging = false; m_isNudging = false;
m_updateCount = UPDATE_COUNT; //KF: Update anims to pickup "STAND"
} }
} }
} }
@ -3015,19 +3017,29 @@ namespace OpenSim.Region.Framework.Scenes
// Event called by the physics plugin to tell the avatar about a collision. // Event called by the physics plugin to tell the avatar about a collision.
private void PhysicsCollisionUpdate(EventArgs e) private void PhysicsCollisionUpdate(EventArgs e)
{ {
if (m_updateCount > 0) //KF: Update Anims for a short period. Many Anim
{ // changes are very asynchronous.
Animator.UpdateMovementAnimations();
m_updateCount--;
}
if (e == null) if (e == null)
return; return;
//if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
// The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents( // The Physics Scene will send updates every 500 ms grep: m_physicsActor.SubscribeEvents(
// as of this comment the interval is set in AddToPhysicalScene // as of this comment the interval is set in AddToPhysicalScene
Animator.UpdateMovementAnimations();
CollisionEventUpdate collisionData = (CollisionEventUpdate)e; CollisionEventUpdate collisionData = (CollisionEventUpdate)e;
Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList;
CollisionPlane = Vector4.UnitW; CollisionPlane = Vector4.UnitW;
if (m_lastColCount != coldata.Count)
{
m_updateCount = 10;
m_lastColCount = coldata.Count;
}
if (coldata.Count != 0) if (coldata.Count != 0)
{ {
switch (Animator.CurrentMovementAnimation) switch (Animator.CurrentMovementAnimation)