diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index c64a0f8..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 | } |
@@ -651,10 +652,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
651 | m_frames.Clear(); | 652 | m_frames.Clear(); |
652 | } | 653 | } |
653 | 654 | ||
654 | Vector3 m_lastPosUpdate; | 655 | [NonSerialized()] Vector3 m_lastPosUpdate; |
655 | Quaternion m_lastRotationUpdate; | 656 | [NonSerialized()] Quaternion m_lastRotationUpdate; |
656 | Vector3 m_currentVel; | 657 | [NonSerialized()] Vector3 m_currentVel; |
657 | int m_skippedUpdates; | 658 | [NonSerialized()] int m_skippedUpdates; |
659 | [NonSerialized()] double m_lasttickMS; | ||
658 | 660 | ||
659 | private void DoOnTimer(double tickDuration) | 661 | private void DoOnTimer(double tickDuration) |
660 | { | 662 | { |
@@ -699,6 +701,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
699 | return; | 701 | return; |
700 | } | 702 | } |
701 | 703 | ||
704 | double nowMS = Util.GetTimeStampMS(); | ||
705 | |||
702 | if (m_frames.Count == 0) | 706 | if (m_frames.Count == 0) |
703 | { | 707 | { |
704 | lock (m_frames) | 708 | lock (m_frames) |
@@ -719,10 +723,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
719 | m_currentVel /= (m_currentFrame.TimeMS * 0.001f); | 723 | m_currentVel /= (m_currentFrame.TimeMS * 0.001f); |
720 | 724 | ||
721 | m_currentFrame.TimeMS += (int)tickDuration; | 725 | m_currentFrame.TimeMS += (int)tickDuration; |
726 | m_lasttickMS = nowMS - 50f; | ||
722 | update = true; | 727 | update = true; |
723 | } | 728 | } |
724 | 729 | ||
725 | 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; | ||
726 | 736 | ||
727 | // Do the frame processing | 737 | // Do the frame processing |
728 | double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration; | 738 | double remainingSteps = (double)m_currentFrame.TimeMS / tickDuration; |
@@ -770,10 +780,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
770 | 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); |
771 | step.Normalize(); | 781 | step.Normalize(); |
772 | m_group.RootPart.RotationOffset = step; | 782 | m_group.RootPart.RotationOffset = step; |
783 | /* | ||
773 | if (Math.Abs(step.X - m_lastRotationUpdate.X) > 0.001f | 784 | if (Math.Abs(step.X - m_lastRotationUpdate.X) > 0.001f |
774 | || Math.Abs(step.Y - m_lastRotationUpdate.Y) > 0.001f | 785 | || Math.Abs(step.Y - m_lastRotationUpdate.Y) > 0.001f |
775 | || Math.Abs(step.Z - m_lastRotationUpdate.Z) > 0.001f) | 786 | || Math.Abs(step.Z - m_lastRotationUpdate.Z) > 0.001f) |
776 | update = true; | 787 | update = true; |
788 | */ | ||
777 | } | 789 | } |
778 | 790 | ||
779 | m_group.AbsolutePosition = m_nextPosition; | 791 | m_group.AbsolutePosition = m_nextPosition; |
@@ -781,7 +793,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
781 | // m_group.RootPart.Velocity = Vector3.Zero; | 793 | // m_group.RootPart.Velocity = Vector3.Zero; |
782 | // else | 794 | // else |
783 | m_group.RootPart.Velocity = m_currentVel; | 795 | m_group.RootPart.Velocity = m_currentVel; |
784 | 796 | /* | |
785 | if(!update && ( | 797 | if(!update && ( |
786 | // lastSteps || | 798 | // lastSteps || |
787 | m_skippedUpdates * tickDuration > 0.5 || | 799 | m_skippedUpdates * tickDuration > 0.5 || |
@@ -794,16 +806,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
794 | } | 806 | } |
795 | else | 807 | else |
796 | m_skippedUpdates++; | 808 | m_skippedUpdates++; |
797 | 809 | */ | |
798 | } | 810 | } |
799 | if(update) | 811 | // if(update) |
800 | { | 812 | // { |
801 | m_lastPosUpdate = m_nextPosition; | 813 | // m_lastPosUpdate = m_nextPosition; |
802 | m_lastRotationUpdate = m_group.GroupRotation; | 814 | // m_lastRotationUpdate = m_group.GroupRotation; |
803 | m_skippedUpdates = 0; | 815 | // m_skippedUpdates = 0; |
804 | // m_group.SendGroupRootTerseUpdate(); | 816 | // m_group.SendGroupRootTerseUpdate(); |
805 | m_group.RootPart.ScheduleTerseUpdate(); | 817 | m_group.RootPart.ScheduleTerseUpdate(); |
806 | } | 818 | // } |
807 | } | 819 | } |
808 | 820 | ||
809 | public Byte[] Serialize() | 821 | public Byte[] Serialize() |