From 12c9916193bbb87aaa95407f798c241cbe5e23cb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 4 May 2012 19:19:54 +0100 Subject: *TO TEST/REVIEW* added current default animation in animationSet.cs to/fromArray in array element 0. This may cause compatibilities issues, but think this information is needed for proper crossings. OSG regions did survived tps in/out with this. ALso added velocity in crossings cases, for now detected by Teleport flag equal to Default (0); --- .../Framework/Scenes/Animation/AnimationSet.cs | 13 +++++++++--- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 23 +++++++++++++++++----- 2 files changed, 28 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 33041e9..da1b9e0 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -168,10 +168,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation public OpenSim.Framework.Animation[] ToArray() { - OpenSim.Framework.Animation[] theArray = new OpenSim.Framework.Animation[m_animations.Count]; + OpenSim.Framework.Animation[] theArray = new OpenSim.Framework.Animation[m_animations.Count + 1]; uint i = 0; try { + theArray[i++] = m_defaultAnimation; foreach (OpenSim.Framework.Animation anim in m_animations) theArray[i++] = anim; } @@ -184,8 +185,14 @@ namespace OpenSim.Region.Framework.Scenes.Animation public void FromArray(OpenSim.Framework.Animation[] theArray) { - foreach (OpenSim.Framework.Animation anim in theArray) - m_animations.Add(anim); +// foreach (OpenSim.Framework.Animation anim in theArray) +// m_animations.Add(anim); + if (theArray.Length > 0) + { + m_defaultAnimation = theArray[0]; + for (int i = 1; i < theArray.Length; i++) + m_animations.Add(theArray[i]); + } } } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7136cfc..991074b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -866,7 +866,7 @@ namespace OpenSim.Region.Framework.Scenes IsChildAgent = false; - Animator.TrySetMovementAnimation("SIT"); +// Animator.TryFixMovementAnimation("SIT"); } else { @@ -929,7 +929,15 @@ namespace OpenSim.Region.Framework.Scenes } AbsolutePosition = pos; - AddToPhysicalScene(isFlying); + if (m_teleportFlags == TeleportFlags.Default) + { + Vector3 vel = Velocity; + AddToPhysicalScene(isFlying); + if (PhysicsActor != null) + PhysicsActor.SetMomentum(vel); + } + else + AddToPhysicalScene(isFlying); if (ForceFly) { @@ -943,7 +951,8 @@ namespace OpenSim.Region.Framework.Scenes // 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 - // Animator.SendAnimPack(); +// Animator.SendAnimPack(); + m_scene.SwapRootAgentCount(false); @@ -980,6 +989,7 @@ namespace OpenSim.Region.Framework.Scenes // If we don't reset the movement flag here, an avatar that crosses to a neighbouring sim and returns will // stall on the border crossing since the existing child agent will still have the last movement // recorded, which stops the input from being processed. + MovementFlag = 0; m_scene.EventManager.TriggerOnMakeRootAgent(this); @@ -1020,6 +1030,8 @@ namespace OpenSim.Region.Framework.Scenes // as teleporting back TeleportFlags = TeleportFlags.Default; + MovementFlag = 0; + // It looks like Animator is set to null somewhere, and MakeChild // is called after that. Probably in aborted teleports. if (Animator == null) @@ -1027,6 +1039,7 @@ namespace OpenSim.Region.Framework.Scenes else Animator.ResetAnimations(); + // m_log.DebugFormat( // "[SCENE PRESENCE]: Downgrading root agent {0}, {1} to a child agent in {2}", // Name, UUID, m_scene.RegionInfo.RegionName); @@ -1053,9 +1066,9 @@ namespace OpenSim.Region.Framework.Scenes { // PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; - m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); - PhysicsActor.UnSubscribeEvents(); PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; + PhysicsActor.UnSubscribeEvents(); + m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); PhysicsActor = null; } // else -- cgit v1.1