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 static extern void PNResetContactEditStatus(int avatarIndex, int frameIndex, ConstraintPoint point);
public static extern void PNBatchResetContactEditStatus(int avatarIndex, int startFrameIndex, int endFrameIndex, ConstraintPoint point);
public static extern void PNBatchEditContact(int avatarIndex, int startFrameIndex, int endFrameIndex, ConstraintPoint point, bool isConstrain);
public static extern void PNGetContactStatus(int avatarIndex, int frameIndex, ConstraintPoint point, ref bool isContact);
public static extern void PNEditContact(int avatarIndex, int frameIndex, ConstraintPoint point, int isConstrain);
public void OnConstraintPoint(ref Pnt2d point) { ConstraintPoint?.Invoke(this, ref point); }