Ejemplo n.º 1
0
        private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation, int linkNum)
        {
            Quaternion oldRot = part.RotationOffset;

            // first fix from old local to world 
            // position
            Vector3 axPos = part.OffsetPosition;
            axPos *= oldGroupRotation;
            part.SetGroupPosition(oldGroupPosition + axPos);
            //offset
            part.SetRotationOffset(false, oldGroupRotation * oldRot ,false);

            // have it in world coords lets fix other things
            m_scene.SceneGraph.LinkPartToSOG(this, part, linkNum);
            part.CreateSelected = true;

            // now lets move to the new parent frame
            Quaternion rootRotation = m_rootPart.RotationOffset;

            Vector3 pos = part.GroupPosition - AbsolutePosition;
            pos *= Quaternion.Inverse(rootRotation);
            part.SetOffsetPosition(pos);

            Quaternion newRot = Quaternion.Inverse(rootRotation) * oldRot;
            part.SetRotationOffset(false,newRot,false);
            // caller will tell the rest about this position changes..

        }