///<summary> /// Constructs a new CompoundCollidable. ///</summary> ///<param name="compoundShape">Compound shape to use for the collidable.</param> public CompoundCollidable(CompoundShape compoundShape) : base(compoundShape) { Events = new CompoundEventManager(); for (int i = 0; i < compoundShape.shapes.Count; i++) { CompoundChild child = GetChild(compoundShape.shapes.Elements[i], i); this.children.Add(child); } hierarchy = new CompoundHierarchy(this); }
///<summary> /// Constructs a compound collidable using additional information about the shapes in the compound. ///</summary> ///<param name="children">Data representing the children of the compound collidable.</param> ///<param name="center">Location computed to be the center of the compound object.</param> public CompoundCollidable(IList <CompoundChildData> children, out Vector3 center) { Events = new CompoundEventManager(); var shapeList = new RawList <CompoundShapeEntry>(); //Create the shape first. for (int i = 0; i < children.Count; i++) { shapeList.Add(children[i].Entry); } base.Shape = new CompoundShape(shapeList, out center); //Now create the actual child objects. for (int i = 0; i < children.Count; i++) { this.children.Add(GetChild(children[i], i)); } hierarchy = new CompoundHierarchy(this); }
//Used to efficiently split compounds. internal CompoundCollidable() { Events = new CompoundEventManager(); hierarchy = new CompoundHierarchy(this); }