diff options
author | Melanie | 2012-03-23 03:16:07 +0100 |
---|---|---|
committer | Melanie | 2012-03-23 03:16:07 +0100 |
commit | ade164667fb7bd9d1996a8791a1f751f191c16bc (patch) | |
tree | 6482486cb9c36703b7781ed3750b4971fd45d7b2 /OpenSim/Region/Framework | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC-ade164667fb7bd9d1996a8791a1f751f191c16bc.zip opensim-SC-ade164667fb7bd9d1996a8791a1f751f191c16bc.tar.gz opensim-SC-ade164667fb7bd9d1996a8791a1f751f191c16bc.tar.bz2 opensim-SC-ade164667fb7bd9d1996a8791a1f751f191c16bc.tar.xz |
Make anims way more snappy. Decouple SP animation handling from physics frame
time.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2346c60..a23dc31 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -233,6 +233,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
233 | private bool m_collisionEventFlag = false; | 233 | private bool m_collisionEventFlag = false; |
234 | private object m_collisionEventLock = new Object(); | 234 | private object m_collisionEventLock = new Object(); |
235 | 235 | ||
236 | private int m_movementAnimationUpdateCounter = 0; | ||
237 | |||
236 | private Vector3 m_prevSitOffset; | 238 | private Vector3 m_prevSitOffset; |
237 | 239 | ||
238 | protected AvatarAppearance m_appearance; | 240 | protected AvatarAppearance m_appearance; |
@@ -741,6 +743,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
741 | Appearance = appearance; | 743 | Appearance = appearance; |
742 | } | 744 | } |
743 | 745 | ||
746 | private void RegionHeartbeatEnd(Scene scene) | ||
747 | { | ||
748 | if (IsChildAgent) | ||
749 | return; | ||
750 | |||
751 | m_movementAnimationUpdateCounter ++; | ||
752 | if (m_movementAnimationUpdateCounter >= 2) | ||
753 | { | ||
754 | m_movementAnimationUpdateCounter = 0; | ||
755 | if (Animator != null) | ||
756 | { | ||
757 | Animator.UpdateMovementAnimations(); | ||
758 | } | ||
759 | else | ||
760 | { | ||
761 | m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; | ||
762 | } | ||
763 | } | ||
764 | } | ||
765 | |||
744 | public void RegisterToEvents() | 766 | public void RegisterToEvents() |
745 | { | 767 | { |
746 | ControllingClient.OnCompleteMovementToRegion += CompleteMovement; | 768 | ControllingClient.OnCompleteMovementToRegion += CompleteMovement; |
@@ -952,6 +974,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
952 | MovementFlag = 0; | 974 | MovementFlag = 0; |
953 | 975 | ||
954 | m_scene.EventManager.TriggerOnMakeRootAgent(this); | 976 | m_scene.EventManager.TriggerOnMakeRootAgent(this); |
977 | |||
978 | m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd; | ||
955 | } | 979 | } |
956 | 980 | ||
957 | public int GetStateSource() | 981 | public int GetStateSource() |
@@ -979,6 +1003,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
979 | /// </remarks> | 1003 | /// </remarks> |
980 | public void MakeChildAgent() | 1004 | public void MakeChildAgent() |
981 | { | 1005 | { |
1006 | m_scene.EventManager.OnRegionHeartbeatEnd -= RegionHeartbeatEnd; | ||
1007 | |||
982 | m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName); | 1008 | m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName); |
983 | 1009 | ||
984 | // Reset these so that teleporting in and walking out isn't seen | 1010 | // Reset these so that teleporting in and walking out isn't seen |
@@ -2377,14 +2403,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2377 | direc.Z *= 2.6f; | 2403 | direc.Z *= 2.6f; |
2378 | 2404 | ||
2379 | // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. | 2405 | // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. |
2380 | Animator.TrySetMovementAnimation("PREJUMP"); | 2406 | // Animator.TrySetMovementAnimation("PREJUMP"); |
2381 | Animator.TrySetMovementAnimation("JUMP"); | 2407 | // Animator.TrySetMovementAnimation("JUMP"); |
2382 | } | 2408 | } |
2383 | } | 2409 | } |
2384 | } | 2410 | } |
2385 | 2411 | ||
2386 | // TODO: Add the force instead of only setting it to support multiple forces per frame? | 2412 | // TODO: Add the force instead of only setting it to support multiple forces per frame? |
2387 | m_forceToApply = direc; | 2413 | m_forceToApply = direc; |
2414 | Animator.UpdateMovementAnimations(); | ||
2388 | } | 2415 | } |
2389 | 2416 | ||
2390 | #endregion | 2417 | #endregion |
@@ -3334,18 +3361,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3334 | if (IsChildAgent) | 3361 | if (IsChildAgent) |
3335 | return; | 3362 | return; |
3336 | 3363 | ||
3337 | //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) | ||
3338 | // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( | ||
3339 | // as of this comment the interval is set in AddToPhysicalScene | ||
3340 | if (Animator != null) | ||
3341 | { | ||
3342 | // if (m_updateCount > 0) | ||
3343 | // { | ||
3344 | Animator.UpdateMovementAnimations(); | ||
3345 | // m_updateCount--; | ||
3346 | // } | ||
3347 | } | ||
3348 | |||
3349 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; | 3364 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; |
3350 | Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; | 3365 | Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; |
3351 | 3366 | ||