diff options
fixed the bug where changing the rotation of a selection of prims in a linkset, made each of those prims rotate around its own centre rather than around the geometric centre of the selection like they should do (and like the client expects).
This involved adding a new OnUpdatePrimSingleRotationPosition event to IClientAPI so that we can get the changed position from the client.
Btw adding new events to IClientAPI is really tedious where you have to copy the change across to at least 5 or 6 other files.
[Note this doesn't fix the bug where any rotation changes to the root prim (but not the whole linkset) cause rotation errors on the child prims.]
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 70 |
1 files changed, 67 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index e987445..00ae504 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -625,6 +625,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
625 | Vector3 backBottomLeft; | 625 | Vector3 backBottomLeft; |
626 | Vector3 backBottomRight; | 626 | Vector3 backBottomRight; |
627 | 627 | ||
628 | // Vector3[] corners = new Vector3[8]; | ||
629 | |||
628 | Vector3 orig = Vector3.Zero; | 630 | Vector3 orig = Vector3.Zero; |
629 | 631 | ||
630 | frontTopLeft.X = orig.X - (part.Scale.X / 2); | 632 | frontTopLeft.X = orig.X - (part.Scale.X / 2); |
@@ -660,6 +662,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
660 | backBottomRight.Y = orig.Y + (part.Scale.Y / 2); | 662 | backBottomRight.Y = orig.Y + (part.Scale.Y / 2); |
661 | backBottomRight.Z = orig.Z - (part.Scale.Z / 2); | 663 | backBottomRight.Z = orig.Z - (part.Scale.Z / 2); |
662 | 664 | ||
665 | //m_log.InfoFormat("pre corner 1 is {0} {1} {2}", frontTopLeft.X, frontTopLeft.Y, frontTopLeft.Z); | ||
666 | //m_log.InfoFormat("pre corner 2 is {0} {1} {2}", frontTopRight.X, frontTopRight.Y, frontTopRight.Z); | ||
667 | //m_log.InfoFormat("pre corner 3 is {0} {1} {2}", frontBottomRight.X, frontBottomRight.Y, frontBottomRight.Z); | ||
668 | //m_log.InfoFormat("pre corner 4 is {0} {1} {2}", frontBottomLeft.X, frontBottomLeft.Y, frontBottomLeft.Z); | ||
669 | //m_log.InfoFormat("pre corner 5 is {0} {1} {2}", backTopLeft.X, backTopLeft.Y, backTopLeft.Z); | ||
670 | //m_log.InfoFormat("pre corner 6 is {0} {1} {2}", backTopRight.X, backTopRight.Y, backTopRight.Z); | ||
671 | //m_log.InfoFormat("pre corner 7 is {0} {1} {2}", backBottomRight.X, backBottomRight.Y, backBottomRight.Z); | ||
672 | //m_log.InfoFormat("pre corner 8 is {0} {1} {2}", backBottomLeft.X, backBottomLeft.Y, backBottomLeft.Z); | ||
673 | |||
674 | //for (int i = 0; i < 8; i++) | ||
675 | //{ | ||
676 | // corners[i] = corners[i] * worldRot; | ||
677 | // corners[i] += offset; | ||
678 | |||
679 | // if (corners[i].X > maxX) | ||
680 | // maxX = corners[i].X; | ||
681 | // if (corners[i].X < minX) | ||
682 | // minX = corners[i].X; | ||
683 | |||
684 | // if (corners[i].Y > maxY) | ||
685 | // maxY = corners[i].Y; | ||
686 | // if (corners[i].Y < minY) | ||
687 | // minY = corners[i].Y; | ||
688 | |||
689 | // if (corners[i].Z > maxZ) | ||
690 | // maxZ = corners[i].Y; | ||
691 | // if (corners[i].Z < minZ) | ||
692 | // minZ = corners[i].Z; | ||
693 | //} | ||
694 | |||
663 | frontTopLeft = frontTopLeft * worldRot; | 695 | frontTopLeft = frontTopLeft * worldRot; |
664 | frontTopRight = frontTopRight * worldRot; | 696 | frontTopRight = frontTopRight * worldRot; |
665 | frontBottomLeft = frontBottomLeft * worldRot; | 697 | frontBottomLeft = frontBottomLeft * worldRot; |
@@ -681,6 +713,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
681 | backTopLeft += offset; | 713 | backTopLeft += offset; |
682 | backTopRight += offset; | 714 | backTopRight += offset; |
683 | 715 | ||
716 | //m_log.InfoFormat("corner 1 is {0} {1} {2}", frontTopLeft.X, frontTopLeft.Y, frontTopLeft.Z); | ||
717 | //m_log.InfoFormat("corner 2 is {0} {1} {2}", frontTopRight.X, frontTopRight.Y, frontTopRight.Z); | ||
718 | //m_log.InfoFormat("corner 3 is {0} {1} {2}", frontBottomRight.X, frontBottomRight.Y, frontBottomRight.Z); | ||
719 | //m_log.InfoFormat("corner 4 is {0} {1} {2}", frontBottomLeft.X, frontBottomLeft.Y, frontBottomLeft.Z); | ||
720 | //m_log.InfoFormat("corner 5 is {0} {1} {2}", backTopLeft.X, backTopLeft.Y, backTopLeft.Z); | ||
721 | //m_log.InfoFormat("corner 6 is {0} {1} {2}", backTopRight.X, backTopRight.Y, backTopRight.Z); | ||
722 | //m_log.InfoFormat("corner 7 is {0} {1} {2}", backBottomRight.X, backBottomRight.Y, backBottomRight.Z); | ||
723 | //m_log.InfoFormat("corner 8 is {0} {1} {2}", backBottomLeft.X, backBottomLeft.Y, backBottomLeft.Z); | ||
724 | |||
684 | if (frontTopRight.X > maxX) | 725 | if (frontTopRight.X > maxX) |
685 | maxX = frontTopRight.X; | 726 | maxX = frontTopRight.X; |
686 | if (frontTopLeft.X > maxX) | 727 | if (frontTopLeft.X > maxX) |
@@ -801,15 +842,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
801 | if (lower > maxZ) | 842 | if (lower > maxZ) |
802 | { | 843 | { |
803 | offsetHeight = lower - (boundingBox.Z / 2); | 844 | offsetHeight = lower - (boundingBox.Z / 2); |
804 | 845 | ||
805 | } | 846 | } |
806 | else if (maxZ > lower) | 847 | else if (maxZ > lower) |
807 | { | 848 | { |
808 | offsetHeight = maxZ - (boundingBox.Z / 2); | 849 | offsetHeight = maxZ - (boundingBox.Z / 2); |
809 | offsetHeight *= -1; | 850 | offsetHeight *= -1; |
810 | } | 851 | } |
811 | 852 | ||
812 | // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); | 853 | // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); |
813 | return boundingBox; | 854 | return boundingBox; |
814 | } | 855 | } |
815 | #endregion | 856 | #endregion |
@@ -3017,6 +3058,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
3017 | /// | 3058 | /// |
3018 | /// </summary> | 3059 | /// </summary> |
3019 | /// <param name="rot"></param> | 3060 | /// <param name="rot"></param> |
3061 | /// <param name="localID"></param> | ||
3062 | public void UpdateSingleRotation(Quaternion rot, Vector3 pos, uint localID) | ||
3063 | { | ||
3064 | SceneObjectPart part = GetChildPart(localID); | ||
3065 | if (part != null) | ||
3066 | { | ||
3067 | if (part.UUID == m_rootPart.UUID) | ||
3068 | { | ||
3069 | UpdateRootRotation(rot); | ||
3070 | AbsolutePosition = pos; | ||
3071 | } | ||
3072 | else | ||
3073 | { | ||
3074 | part.UpdateRotation(rot); | ||
3075 | part.OffsetPosition = pos; | ||
3076 | } | ||
3077 | } | ||
3078 | } | ||
3079 | |||
3080 | /// <summary> | ||
3081 | /// | ||
3082 | /// </summary> | ||
3083 | /// <param name="rot"></param> | ||
3020 | private void UpdateRootRotation(Quaternion rot) | 3084 | private void UpdateRootRotation(Quaternion rot) |
3021 | { | 3085 | { |
3022 | Quaternion axRot = rot; | 3086 | Quaternion axRot = rot; |