aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorteravus2013-08-24 18:55:21 -0500
committerteravus2013-09-16 11:32:05 -0500
commit120b6948ed873a3af7713b411b956b8cb4c7f516 (patch)
tree309557e12aa44541bf8a340a8dda108da60bc468 /OpenSim
parent* Fix a null ref that causes a stack unwind when crossing borders. Less stac... (diff)
downloadopensim-SC_OLD-120b6948ed873a3af7713b411b956b8cb4c7f516.zip
opensim-SC_OLD-120b6948ed873a3af7713b411b956b8cb4c7f516.tar.gz
opensim-SC_OLD-120b6948ed873a3af7713b411b956b8cb4c7f516.tar.bz2
opensim-SC_OLD-120b6948ed873a3af7713b411b956b8cb4c7f516.tar.xz
* This fixes the border crossing offsets by storing the final keyframe location in the hijacked variable KeyFrame.AngularVelocity. When steps in OnTimer <= 0.0, normalize the final position by Constants.RegionSize and move the object there. The hack here is KeyFrame.AngularVelocity probably isn't the right name for this variable because it's the un-mucked with keyframe position. When you determine the feasibility of changing the name without affecting the serialization of existing objects in world... It's simply a name change to KeyFrame.FinalPosition or something proper.
(cherry picked from commit e0399ccaec68889c12e4679b4d62142b49b379df)
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/KeyframeMotion.cs24
1 files changed, 22 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
index 29652aa..4d153da 100644
--- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
+++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
@@ -498,6 +498,7 @@ namespace OpenSim.Region.Framework.Scenes
498 k.Position = pos; 498 k.Position = pos;
499// k.Velocity = Vector3.Zero; 499// k.Velocity = Vector3.Zero;
500 } 500 }
501 k.AngularVelocity = (Vector3)k.Position;
501 502
502 k.StartRotation = rot; 503 k.StartRotation = rot;
503 if (k.Rotation.HasValue) 504 if (k.Rotation.HasValue)
@@ -632,13 +633,13 @@ namespace OpenSim.Region.Framework.Scenes
632 633
633 // Do the frame processing 634 // Do the frame processing
634 double steps = (double)m_currentFrame.TimeMS / tickDuration; 635 double steps = (double)m_currentFrame.TimeMS / tickDuration;
635 636
636 if (steps <= 0.0) 637 if (steps <= 0.0)
637 { 638 {
638 m_group.RootPart.Velocity = Vector3.Zero; 639 m_group.RootPart.Velocity = Vector3.Zero;
639 m_group.RootPart.AngularVelocity = Vector3.Zero; 640 m_group.RootPart.AngularVelocity = Vector3.Zero;
640 641
641 m_nextPosition = (Vector3)m_currentFrame.Position; 642 m_nextPosition = NormalizeVector(m_currentFrame.AngularVelocity);
642 m_group.AbsolutePosition = m_nextPosition; 643 m_group.AbsolutePosition = m_nextPosition;
643 644
644 // we are sending imediate updates, no doing force a extra terseUpdate 645 // we are sending imediate updates, no doing force a extra terseUpdate
@@ -726,7 +727,26 @@ namespace OpenSim.Region.Framework.Scenes
726 m_group.SendGroupRootTerseUpdate(); 727 m_group.SendGroupRootTerseUpdate();
727 } 728 }
728 } 729 }
730 private Vector3 NormalizeVector(Vector3? pPosition)
731 {
732 if (pPosition == null)
733 return Vector3.Zero;
734
735 Vector3 tmp = (Vector3) pPosition;
729 736
737 while (tmp.X > Constants.RegionSize)
738 tmp.X -= Constants.RegionSize;
739 while (tmp.X < 0)
740 tmp.X += Constants.RegionSize;
741 while (tmp.Y > Constants.RegionSize)
742 tmp.Y -= Constants.RegionSize;
743 while (tmp.Y < 0)
744 tmp.Y += Constants.RegionSize;
745
746 return tmp;
747
748
749 }
730 public Byte[] Serialize() 750 public Byte[] Serialize()
731 { 751 {
732 StopTimer(); 752 StopTimer();