コード例 #1
0
ファイル: SceneObjectGroup.cs プロジェクト: zwagoth/halcyon
        /// <summary>
        /// Add a new part to this scene object.  The part must already be correctly configured.
        /// </summary>
        /// <param name="part"></param>
        public void AddPart(SceneObjectPart part)
        {
            lock (m_parts)
            {
                part.SetParentAndUpdatePhysics(this);
                m_parts.Add(part.UUID, part);
                this.TrackLocalId(part, part.LocalId);

                part.LinkNum = m_parts.Count;

                if (part.LinkNum == 2 && RootPart != null)
                    RootPart.LinkNum = 1;

                //Rebuild the bounding box
                ClearBoundingBoxCache();

                // Update the ServerWeight/LandImpact
                RecalcPrimWeights();
            }
        }
コード例 #2
0
ファイル: SceneObjectGroup.cs プロジェクト: zwagoth/halcyon
        private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation, int linkNum)
        {
            Quaternion parentRot = oldGroupRotation;
            Quaternion oldRot = part.RotationOffset;
            Quaternion worldRot = parentRot * oldRot;

            Vector3 partOffsetPosition = part.OffsetPosition;
            Vector3 partGroupPosition = part.GroupPosition;
            Quaternion partRotationOffset = part.RotationOffset;

            parentRot = oldGroupRotation;

            Vector3 axPos = partOffsetPosition;
            axPos *= parentRot;
            partOffsetPosition = axPos;

            partGroupPosition = oldGroupPosition + partOffsetPosition;
            partOffsetPosition = Vector3.Zero;
            partRotationOffset = worldRot;

            // Caller locks m_parts for us
            m_parts.Add(part.UUID, part);
            this.TrackLocalId(part, part.LocalId);

            part.LinkNum = linkNum;

            partOffsetPosition = partGroupPosition - AbsolutePosition;

            Quaternion rootRotation = m_rootPart.RotationOffset;

            Vector3 pos = partOffsetPosition;
            pos *= Quaternion.Inverse(rootRotation);
            partOffsetPosition = pos;

            parentRot = m_rootPart.RotationOffset;
            oldRot = partRotationOffset;
            Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
            partRotationOffset = newRot;

            part.SetOffsetPositionDirect(partOffsetPosition);
            part.SetGroupPositionDirect(partGroupPosition);
            part.SetRotationOffsetDirect(partRotationOffset);

            part.ParentID = m_rootPart.LocalId;
            part.SetParentAndUpdatePhysics(this);
        }
コード例 #3
0
ファイル: SceneObjectGroup.cs プロジェクト: kf6kjg/halcyon
        /// <summary>
        /// Add a new part to this scene object.  The part must already be correctly configured.
        /// </summary>
        /// <param name="part"></param>
        public void AddPart(SceneObjectPart part)
        {
            part.SetParentAndUpdatePhysics(this);
            int count = m_childParts.AddPart(part);

            part.LinkNum = count;

            if (part.LinkNum == 2 && RootPart != null)
                RootPart.LinkNum = 1;

            //Rebuild the bounding box
            ClearBoundingBoxCache();

            // Update the ServerWeight/LandImpact
            RecalcPrimWeights();
            RecalcScriptedStatus();
        }