// Remove the specified child from the linkset.
        // Safe to call even if the child is not really in the linkset.
        protected override void RemoveChildFromLinkset(BSPrimLinkable child)
        {
            child.ClearDisplacement();

            if (m_children.Remove(child))
            {
                DetailLog("{0},BSLinksetCompound.RemoveChildFromLinkset,call,rID={1},rBody={2},cID={3},cBody={4}",
                          child.LocalID,
                          LinksetRoot.LocalID, LinksetRoot.PhysBody.AddrString,
                          child.LocalID, child.PhysBody.AddrString);

                // Cause the child's body to be rebuilt and thus restored to normal operation
                RecomputeChildWorldPosition(child, false);
                child.LinksetInfo = null;
                child.ForceBodyShapeRebuild(false);

                if (!HasAnyChildren)
                {
                    // The linkset is now empty. The root needs rebuilding.
                    LinksetRoot.ForceBodyShapeRebuild(false);
                }
                else
                {
                    // Rebuild the compound shape with the child removed
                    ScheduleRebuild(LinksetRoot);
                }
            }
            return;
        }
예제 #2
0
        protected BSLinkset(BSScene scene, BSPrimLinkable parent)
        {
            // A simple linkset of one (no children)
            LinksetID = m_nextLinksetID++;
            // We create LOTS of linksets.
            if (m_nextLinksetID <= 0)
            {
                m_nextLinksetID = 1;
            }
            PhysicsScene = scene;
            LinksetRoot  = parent;
            m_children   = new HashSet <BSPrimLinkable>();
            LinksetMass  = parent.RawMass;
            Rebuilding   = false;

            parent.ClearDisplacement();
        }