diff options
author | teravus | 2013-08-24 18:55:21 -0500 |
---|---|---|
committer | teravus | 2013-08-24 18:55:21 -0500 |
commit | e0399ccaec68889c12e4679b4d62142b49b379df (patch) | |
tree | 3d4bd4f6472c022689ba496d9b80fb7ba3adbb5f /OpenSim | |
parent | * Fix a null ref that causes a stack unwind when crossing borders. Less stac... (diff) | |
download | opensim-SC_OLD-e0399ccaec68889c12e4679b4d62142b49b379df.zip opensim-SC_OLD-e0399ccaec68889c12e4679b4d62142b49b379df.tar.gz opensim-SC_OLD-e0399ccaec68889c12e4679b4d62142b49b379df.tar.bz2 opensim-SC_OLD-e0399ccaec68889c12e4679b4d62142b49b379df.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.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index d773ee7..d9df95c 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | |||
@@ -478,6 +478,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
478 | k.Position = pos; | 478 | k.Position = pos; |
479 | // k.Velocity = Vector3.Zero; | 479 | // k.Velocity = Vector3.Zero; |
480 | } | 480 | } |
481 | k.AngularVelocity = (Vector3)k.Position; | ||
481 | 482 | ||
482 | k.StartRotation = rot; | 483 | k.StartRotation = rot; |
483 | if (k.Rotation.HasValue) | 484 | if (k.Rotation.HasValue) |
@@ -612,13 +613,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
612 | 613 | ||
613 | // Do the frame processing | 614 | // Do the frame processing |
614 | double steps = (double)m_currentFrame.TimeMS / tickDuration; | 615 | double steps = (double)m_currentFrame.TimeMS / tickDuration; |
615 | 616 | ||
616 | if (steps <= 0.0) | 617 | if (steps <= 0.0) |
617 | { | 618 | { |
618 | m_group.RootPart.Velocity = Vector3.Zero; | 619 | m_group.RootPart.Velocity = Vector3.Zero; |
619 | m_group.RootPart.AngularVelocity = Vector3.Zero; | 620 | m_group.RootPart.AngularVelocity = Vector3.Zero; |
620 | 621 | ||
621 | m_nextPosition = (Vector3)m_currentFrame.Position; | 622 | m_nextPosition = NormalizeVector(m_currentFrame.AngularVelocity); |
622 | m_group.AbsolutePosition = m_nextPosition; | 623 | m_group.AbsolutePosition = m_nextPosition; |
623 | 624 | ||
624 | // we are sending imediate updates, no doing force a extra terseUpdate | 625 | // we are sending imediate updates, no doing force a extra terseUpdate |
@@ -706,7 +707,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
706 | m_group.SendGroupRootTerseUpdate(); | 707 | m_group.SendGroupRootTerseUpdate(); |
707 | } | 708 | } |
708 | } | 709 | } |
710 | private Vector3 NormalizeVector(Vector3? pPosition) | ||
711 | { | ||
712 | if (pPosition == null) | ||
713 | return Vector3.Zero; | ||
714 | |||
715 | Vector3 tmp = (Vector3) pPosition; | ||
709 | 716 | ||
717 | while (tmp.X > Constants.RegionSize) | ||
718 | tmp.X -= Constants.RegionSize; | ||
719 | while (tmp.X < 0) | ||
720 | tmp.X += Constants.RegionSize; | ||
721 | while (tmp.Y > Constants.RegionSize) | ||
722 | tmp.Y -= Constants.RegionSize; | ||
723 | while (tmp.Y < 0) | ||
724 | tmp.Y += Constants.RegionSize; | ||
725 | |||
726 | return tmp; | ||
727 | |||
728 | |||
729 | } | ||
710 | public Byte[] Serialize() | 730 | public Byte[] Serialize() |
711 | { | 731 | { |
712 | StopTimer(); | 732 | StopTimer(); |