aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs41
1 files changed, 28 insertions, 13 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index a534522..568e216 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -617,7 +617,7 @@ namespace OpenSim.Region.ClientStack.Linden
617 = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); 617 = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero);
618 618
619 prim.Scale = scale; 619 prim.Scale = scale;
620 prim.OffsetPosition = position; 620 //prim.OffsetPosition = position;
621 rotations.Add(rotation); 621 rotations.Add(rotation);
622 positions.Add(position); 622 positions.Add(position);
623 prim.UUID = UUID.Random(); 623 prim.UUID = UUID.Random();
@@ -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