// Remove a child from a linkset. // Returns a new linkset for the child which is a linkset of one (just the // orphened child). // Called at runtime. public BSLinkset RemoveMeFromLinkset(BSPhysObject child) { lock (m_linksetActivityLock) { if (IsRoot(child)) { // Cannot remove the root from a linkset. return(this); } RemoveChildFromLinkset(child); LinksetMass = ComputeLinksetMass(); } // The child is down to a linkset of just itself return(BSLinkset.Factory(PhysicsScene, child)); }
protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName) { PhysicsScene = parentScene; LocalID = localID; PhysObjectName = name; TypeName = typeName; Linkset = BSLinkset.Factory(PhysicsScene, this); LastAssetBuildFailed = false; // Default material type Material = MaterialAttributes.Material.Wood; CollisionCollection = new CollisionEventUpdate(); SubscribedEventsMs = 0; CollidingStep = 0; CollidingGroundStep = 0; }
// Create the correct type of linkset for this child public static BSLinkset Factory(BSScene physScene, BSPhysObject parent) { BSLinkset ret = null; switch ((int)BSParam.LinksetImplementation) { case (int)LinksetImplementation.Constraint: ret = new BSLinksetConstraints(physScene, parent); break; case (int)LinksetImplementation.Compound: ret = new BSLinksetCompound(physScene, parent); break; case (int)LinksetImplementation.Manual: // ret = new BSLinksetManual(physScene, parent); break; default: ret = new BSLinksetCompound(physScene, parent); break; } return(ret); }