aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs39
1 files changed, 27 insertions, 12 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index a534522..6ebe660 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -641,25 +641,40 @@ namespace OpenSim.Region.ClientStack.Linden
641 grp.AddPart(prim); 641 grp.AddPart(prim);
642 } 642 }
643 643
644 // Fix first link number 644 Vector3 rootPos = positions[0];
645
645 if (grp.Parts.Length > 1) 646 if (grp.Parts.Length > 1)
647 {
648 // Fix first link number
646 grp.RootPart.LinkNum++; 649 grp.RootPart.LinkNum++;
647 650
648 Vector3 rootPos = positions[0]; 651 Quaternion rootRotConj = Quaternion.Conjugate(rotations[0]);
649 grp.AbsolutePosition = rootPos; 652 Quaternion tmprot;
650 for (int i = 0; i < positions.Count; i++) 653 Vector3 offset;
651 { 654
652 Vector3 offset = positions[i] - rootPos; 655 // fix children rotations and positions
653 grp.Parts[i].OffsetPosition = offset; 656 for (int i = 1; i < rotations.Count; i++)
654 } 657 {
658 tmprot = rotations[i];
659 tmprot = rootRotConj * tmprot;
660
661 grp.Parts[i].RotationOffset = tmprot;
655 662
656 for (int i = 0; i < rotations.Count; i++) 663 offset = positions[i] - rootPos;
664
665 offset *= rootRotConj;
666 grp.Parts[i].OffsetPosition = offset;
667 }
668
669 grp.AbsolutePosition = rootPos;
670 grp.UpdateGroupRotationR(rotations[0]);
671 }
672 else
657 { 673 {
658 if (i != 0) 674 grp.AbsolutePosition = rootPos;
659 grp.Parts[i].RotationOffset = rotations[i]; 675 grp.UpdateGroupRotationR(rotations[0]);
660 } 676 }
661 677
662 grp.UpdateGroupRotationR(rotations[0]);
663 data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp)); 678 data = ASCIIEncoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(grp));
664 } 679 }
665 680