aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2013-02-05 20:09:02 +0000
committerJustin Clark-Casey (justincc)2013-02-08 21:31:38 +0000
commite3f01f23afe9ceb3eb46dc95791bf13632c57ea6 (patch)
treec4610d2fa1f71ed54059befc1a216618288f7efd /OpenSim/Region
parentAdded option for UUID as command parameters. This lets the command handle the... (diff)
downloadopensim-SC_OLD-e3f01f23afe9ceb3eb46dc95791bf13632c57ea6.zip
opensim-SC_OLD-e3f01f23afe9ceb3eb46dc95791bf13632c57ea6.tar.gz
opensim-SC_OLD-e3f01f23afe9ceb3eb46dc95791bf13632c57ea6.tar.bz2
opensim-SC_OLD-e3f01f23afe9ceb3eb46dc95791bf13632c57ea6.tar.xz
Try to fix uploaded mesh rotations - code from Avination code base.
Diffstat (limited to 'OpenSim/Region')
-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