diff options
author | UbitUmarov | 2017-07-20 11:30:12 +0100 |
---|---|---|
committer | UbitUmarov | 2017-07-20 11:30:12 +0100 |
commit | fe6ad384e43c11c3bf6268f5ab6fe3ea37c74540 (patch) | |
tree | 44ae3d8b00f3d2f6bf78bc0226a779f99ed6dc48 /OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | |
parent | Merge branch 'master' into httptests (diff) | |
parent | fix object updates throttle for scripts doing motion by direct change of posi... (diff) | |
download | opensim-SC-fe6ad384e43c11c3bf6268f5ab6fe3ea37c74540.zip opensim-SC-fe6ad384e43c11c3bf6268f5ab6fe3ea37c74540.tar.gz opensim-SC-fe6ad384e43c11c3bf6268f5ab6fe3ea37c74540.tar.bz2 opensim-SC-fe6ad384e43c11c3bf6268f5ab6fe3ea37c74540.tar.xz |
merge
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/KeyframeMotion.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | 83 |
1 files changed, 50 insertions, 33 deletions
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index d81d8a2..80ee510 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | |||
@@ -295,6 +295,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
295 | lock (m_frames) | 295 | lock (m_frames) |
296 | { | 296 | { |
297 | KeyframeTimer.Add(this); | 297 | KeyframeTimer.Add(this); |
298 | m_lasttickMS = Util.GetTimeStampMS(); | ||
298 | m_timerStopped = false; | 299 | m_timerStopped = false; |
299 | } | 300 | } |
300 | } | 301 | } |
@@ -326,8 +327,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
326 | newMotion.m_selected = true; | 327 | newMotion.m_selected = true; |
327 | } | 328 | } |
328 | 329 | ||
329 | newMotion.m_timerStopped = false; | 330 | // newMotion.m_timerStopped = false; |
330 | newMotion.m_running = true; | 331 | // newMotion.m_running = true; |
331 | newMotion.m_isCrossing = false; | 332 | newMotion.m_isCrossing = false; |
332 | newMotion.m_waitingCrossing = false; | 333 | newMotion.m_waitingCrossing = false; |
333 | } | 334 | } |
@@ -483,9 +484,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
483 | 484 | ||
484 | m_group.RootPart.Velocity = Vector3.Zero; | 485 | m_group.RootPart.Velocity = Vector3.Zero; |
485 | m_group.RootPart.AngularVelocity = Vector3.Zero; | 486 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
486 | m_group.SendGroupRootTerseUpdate(); | 487 | // m_group.SendGroupRootTerseUpdate(); |
487 | // m_group.RootPart.ScheduleTerseUpdate(); | 488 | m_group.RootPart.ScheduleTerseUpdate(); |
488 | m_frames.Clear(); | 489 | m_frames.Clear(); |
490 | m_group.Scene.EventManager.TriggerMovingEndEvent(m_group.RootPart.LocalId); | ||
489 | } | 491 | } |
490 | 492 | ||
491 | public void Pause() | 493 | public void Pause() |
@@ -496,8 +498,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
496 | m_group.RootPart.Velocity = Vector3.Zero; | 498 | m_group.RootPart.Velocity = Vector3.Zero; |
497 | m_group.RootPart.AngularVelocity = Vector3.Zero; | 499 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
498 | m_skippedUpdates = 1000; | 500 | m_skippedUpdates = 1000; |
499 | m_group.SendGroupRootTerseUpdate(); | 501 | // m_group.SendGroupRootTerseUpdate(); |
500 | // m_group.RootPart.ScheduleTerseUpdate(); | 502 | m_group.RootPart.ScheduleTerseUpdate(); |
503 | m_group.Scene.EventManager.TriggerMovingEndEvent(m_group.RootPart.LocalId); | ||
501 | } | 504 | } |
502 | 505 | ||
503 | public void Suspend() | 506 | public void Suspend() |
@@ -644,15 +647,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
644 | 647 | ||
645 | m_group.RootPart.Velocity = Vector3.Zero; | 648 | m_group.RootPart.Velocity = Vector3.Zero; |
646 | m_group.RootPart.AngularVelocity = Vector3.Zero; | 649 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
647 | m_group.SendGroupRootTerseUpdate(); | 650 | // m_group.SendGroupRootTerseUpdate(); |
648 | 651 | m_group.RootPart.ScheduleTerseUpdate(); | |
649 | m_frames.Clear(); | 652 | m_frames.Clear(); |
650 | } | 653 | } |
651 | 654 | ||
652 | Vector3 m_lastPosUpdate; | 655 | [NonSerialized()] Vector3 m_lastPosUpdate; |
653 | Quaternion m_lastRotationUpdate; | 656 | [NonSerialized()] Quaternion m_lastRotationUpdate; |
654 | Vector3 m_currentVel; | 657 | [NonSerialized()] Vector3 m_currentVel; |
655 | int m_skippedUpdates; | 658 | [NonSerialized()] int m_skippedUpdates; |
659 | [NonSerialized()] double m_lasttickMS; | ||
656 | 660 | ||
657 | private void DoOnTimer(double tickDuration) | 661 | private void DoOnTimer(double tickDuration) |
658 | { | 662 | { |
@@ -673,7 +677,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
673 | { | 677 | { |
674 | m_group.RootPart.Velocity = Vector3.Zero; | 678 | m_group.RootPart.Velocity = Vector3.Zero; |
675 | m_skippedUpdates = 1000; | 679 | m_skippedUpdates = 1000; |
676 | m_group.SendGroupRootTerseUpdate(); | 680 | // m_group.SendGroupRootTerseUpdate(); |
681 | m_group.RootPart.ScheduleTerseUpdate(); | ||
677 | } | 682 | } |
678 | return; | 683 | return; |
679 | } | 684 | } |
@@ -696,6 +701,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
696 | return; | 701 | return; |
697 | } | 702 | } |
698 | 703 | ||
704 | double nowMS = Util.GetTimeStampMS(); | ||
705 | |||
699 | if (m_frames.Count == 0) | 706 | if (m_frames.Count == 0) |
700 | { | 707 | { |
701 | lock (m_frames) | 708 | lock (m_frames) |
@@ -716,10 +723,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
716 | m_currentVel /= (m_currentFrame.TimeMS * 0.001f); | 723 | m_currentVel /= (m_currentFrame.TimeMS * 0.001f); |
717 | 724 | ||
718 | m_currentFrame.TimeMS += (int)tickDuration; | 725 | m_currentFrame.TimeMS += (int)tickDuration; |
726 | m_lasttickMS = nowMS - 50f; | ||
719 | update = true; | 727 | update = true; |
720 | } | 728 | } |
721 | 729 | ||
722 | m_currentFrame.TimeMS -= (int)tickDuration; | 730 | int elapsed = (int)(nowMS - m_lasttickMS); |
731 | if( elapsed > 3 * tickDuration) | ||
732 | elapsed = (int)tickDuration; | ||
733 | |||
734 | m_currentFrame.TimeMS -= elapsed; | ||
735 | m_lasttickMS = nowMS; | ||
723 | 736 | ||
724 | // Do the frame processing | 737 | // Do the frame processing |
725 | double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration; | 738 | double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration; |
@@ -752,7 +765,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
752 | } | 765 | } |
753 | else | 766 | else |
754 | { | 767 | { |
755 | bool lastSteps = remainingSteps < 4; | 768 | // bool lastSteps = remainingSteps < 4; |
769 | |||
756 | Vector3 currentPosition = m_group.AbsolutePosition; | 770 | Vector3 currentPosition = m_group.AbsolutePosition; |
757 | Vector3 motionThisFrame = (Vector3)m_currentFrame.Position - currentPosition; | 771 | Vector3 motionThisFrame = (Vector3)m_currentFrame.Position - currentPosition; |
758 | motionThisFrame /= (float)remainingSteps; | 772 | motionThisFrame /= (float)remainingSteps; |
@@ -766,20 +780,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
766 | Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed); | 780 | Quaternion step = Quaternion.Slerp(m_currentFrame.StartRotation, (Quaternion)m_currentFrame.Rotation, completed); |
767 | step.Normalize(); | 781 | step.Normalize(); |
768 | m_group.RootPart.RotationOffset = step; | 782 | m_group.RootPart.RotationOffset = step; |
783 | /* | ||
769 | if (Math.Abs(step.X - m_lastRotationUpdate.X) > 0.001f | 784 | if (Math.Abs(step.X - m_lastRotationUpdate.X) > 0.001f |
770 | || Math.Abs(step.Y - m_lastRotationUpdate.Y) > 0.001f | 785 | || Math.Abs(step.Y - m_lastRotationUpdate.Y) > 0.001f |
771 | || Math.Abs(step.Z - m_lastRotationUpdate.Z) > 0.001f) | 786 | || Math.Abs(step.Z - m_lastRotationUpdate.Z) > 0.001f) |
772 | update = true; | 787 | update = true; |
788 | */ | ||
773 | } | 789 | } |
774 | 790 | ||
775 | m_group.AbsolutePosition = m_nextPosition; | 791 | m_group.AbsolutePosition = m_nextPosition; |
776 | if(lastSteps) | 792 | // if(lastSteps) |
777 | m_group.RootPart.Velocity = Vector3.Zero; | 793 | // m_group.RootPart.Velocity = Vector3.Zero; |
778 | else | 794 | // else |
779 | m_group.RootPart.Velocity = m_currentVel; | 795 | m_group.RootPart.Velocity = m_currentVel; |
780 | 796 | /* | |
781 | if(!update && ( | 797 | if(!update && ( |
782 | lastSteps || | 798 | // lastSteps || |
783 | m_skippedUpdates * tickDuration > 0.5 || | 799 | m_skippedUpdates * tickDuration > 0.5 || |
784 | Math.Abs(m_nextPosition.X - currentPosition.X) > 5f || | 800 | Math.Abs(m_nextPosition.X - currentPosition.X) > 5f || |
785 | Math.Abs(m_nextPosition.Y - currentPosition.Y) > 5f || | 801 | Math.Abs(m_nextPosition.Y - currentPosition.Y) > 5f || |
@@ -790,15 +806,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
790 | } | 806 | } |
791 | else | 807 | else |
792 | m_skippedUpdates++; | 808 | m_skippedUpdates++; |
793 | 809 | */ | |
794 | } | 810 | } |
795 | if(update) | 811 | // if(update) |
796 | { | 812 | // { |
797 | m_lastPosUpdate = m_nextPosition; | 813 | // m_lastPosUpdate = m_nextPosition; |
798 | m_lastRotationUpdate = m_group.GroupRotation; | 814 | // m_lastRotationUpdate = m_group.GroupRotation; |
799 | m_skippedUpdates = 0; | 815 | // m_skippedUpdates = 0; |
800 | m_group.SendGroupRootTerseUpdate(); | 816 | // m_group.SendGroupRootTerseUpdate(); |
801 | } | 817 | m_group.RootPart.ScheduleTerseUpdate(); |
818 | // } | ||
802 | } | 819 | } |
803 | 820 | ||
804 | public Byte[] Serialize() | 821 | public Byte[] Serialize() |
@@ -842,8 +859,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
842 | { | 859 | { |
843 | m_group.RootPart.Velocity = Vector3.Zero; | 860 | m_group.RootPart.Velocity = Vector3.Zero; |
844 | m_skippedUpdates = 1000; | 861 | m_skippedUpdates = 1000; |
845 | m_group.SendGroupRootTerseUpdate(); | 862 | // m_group.SendGroupRootTerseUpdate(); |
846 | // m_group.RootPart.ScheduleTerseUpdate(); | 863 | m_group.RootPart.ScheduleTerseUpdate(); |
847 | } | 864 | } |
848 | } | 865 | } |
849 | 866 | ||
@@ -855,8 +872,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
855 | { | 872 | { |
856 | m_group.RootPart.Velocity = Vector3.Zero; | 873 | m_group.RootPart.Velocity = Vector3.Zero; |
857 | m_skippedUpdates = 1000; | 874 | m_skippedUpdates = 1000; |
858 | m_group.SendGroupRootTerseUpdate(); | 875 | // m_group.SendGroupRootTerseUpdate(); |
859 | // m_group.RootPart.ScheduleTerseUpdate(); | 876 | m_group.RootPart.ScheduleTerseUpdate(); |
860 | 877 | ||
861 | if (m_running) | 878 | if (m_running) |
862 | { | 879 | { |