Пример #1
0
        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);
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
        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;
            }
        }
Пример #4
0
        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);
        }
Пример #5
0
 public void AddPart(ref EntityPart rb)
 {
     parts.Add(rb.Id, rb);
 }
Пример #6
0
        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);
        }
Пример #7
0
 /// <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);
 }