private void AddPart(int pid, Part part, SortedList <string, Model> models) { int id = GetPartId(); EntityPart ep = new EntityPart(id, models[CleanPath(part.Model.relFilepath)], part); // add this parts under a parent AddPart(pid, ep); // add this parts' children AddParts(id, part.Parts, models); }
public void AddPart(int parentId, EntityPart child) { if (!partList.ContainsKey(child.Id)) { partList.Add(child.Id, child); } child.body.CollisionSkin.callbackFn += new CollisionCallbackFn(PartCollisioncallbackFn); if (partList.ContainsKey(parentId)) { EntityPart parent = partList[parentId]; /* * collision skin types which should or should not collide with those in another certain group. * * */ if (child.part.Name == "fuselageA") { JigLibX.Physics.ConstraintPoint c = new ConstraintPoint(parent.body, new Vector3(3, 3, 3), child.body, new Vector3(-3, -3, 3), 0, 1f); PhysicsSystem.CurrentPhysicsSystem.AddConstraint(c); c.EnableConstraint(); JigLibX.Physics.ConstraintPoint c2 = new ConstraintPoint(parent.body, new Vector3(3, 3, -3), child.body, new Vector3(-3, -3, -3), 0, 1f); PhysicsSystem.CurrentPhysicsSystem.AddConstraint(c2); c2.EnableConstraint(); JigLibX.Physics.ConstraintPoint c3 = new ConstraintPoint(parent.body, new Vector3(3, -3, 0), child.body, new Vector3(-3, -6, 0), 0, 1f); PhysicsSystem.CurrentPhysicsSystem.AddConstraint(c3); c3.EnableConstraint(); } else if (child.part.Name == "fuselageB") { JigLibX.Physics.ConstraintPoint c = new ConstraintPoint(parent.body, new Vector3(-3, 3, 3), child.body, new Vector3(3, -3, 3), 0, 1f); PhysicsSystem.CurrentPhysicsSystem.AddConstraint(c); c.EnableConstraint(); JigLibX.Physics.ConstraintPoint c2 = new ConstraintPoint(parent.body, new Vector3(-3, 3, -3), child.body, new Vector3(3, -3, -3), 0, 1f); PhysicsSystem.CurrentPhysicsSystem.AddConstraint(c2); c2.EnableConstraint(); JigLibX.Physics.ConstraintPoint c3 = new ConstraintPoint(parent.body, new Vector3(-3, -3, 0), child.body, new Vector3(3, -6, 0), 0, 1f); PhysicsSystem.CurrentPhysicsSystem.AddConstraint(c3); c3.EnableConstraint(); } parent.AddPart(ref child); child.fParentPart = parent; } }
public void AddPart(int parentId, EntityPart child) { if (!parts.ContainsKey(child.Id)) { parts.Add(child.Id, child); } child.body.CollisionSkin.callbackFn += new CollisionCallbackFn(PartCollisioncallbackFn); if (parts.ContainsKey(parentId)) { EntityPart parent = parts[parentId]; parent.AddPart(ref child); child.fParentPart = parent; } }
public static EntityPart GetPart(int id, Model m, Vector3 scale, Vector3 orientYPR, Vector3 RelativeOrigin, Vector3 modelOrientCorrection, Vector3 modelOriginCorrection) { EntityPart rb = new EntityPart(id, m, scale, orientYPR, RelativeOrigin, modelOrientCorrection, modelOriginCorrection); return(rb); }
public void AddPart(ref EntityPart rb) { parts.Add(rb.Id, rb); }
public void AddPart(int id, Model m, Vector3 scale, Vector3 orientYPR, Vector3 RelativeOrigin, Vector3 modelOrientCorrection, Vector3 modelOriginCorrection) { EntityPart rb = new EntityPart(id, m, scale, orientYPR, RelativeOrigin, modelOrientCorrection, modelOriginCorrection); parts.Add(id, rb); }
/// <summary> /// Default Constructor /// Initalizes the Body and a CollisionSkin /// No Primatives are added to the Body /// </summary> /// <param name="position">Initial Body Position</param> /// <param name="scale">Scale</param> public Entity() { root = new EntityPart(true); partList.Add(0, root); }