Beispiel #1
0
 public BepuEntity createShoeRight(Vector3 position, float width, float height, float length)
 {
     BepuEntity theBox2 = new BepuEntity();
     theBox2.modelName = "BrakeShoeRight23";
     theBox2.localTransform = Matrix.CreateScale(new Vector3(width, height, length));
     theBox2.body = new Box(position, 2, 6, .5f, 1);
     XNAGame.Instance().space.Add(theBox2.body);
     XNAGame.Instance().children.Add(theBox2);
     theBox2.HasColor = true;
        // modelDrawer.Add(theBox2.body);
     return theBox2;
 }
Beispiel #2
0
 public BepuEntity createShoeLeft(Vector3 position, float width, float height, float length)
 {
     BepuEntity theBox3 = new BepuEntity();
     theBox3.modelName = "brakeshoeleft2";
     theBox3.localTransform = Matrix.CreateScale(new Vector3(width, height, length));
     theBox3.body = new Box((new Vector3(position.X, position.Y, position.Z)), 2, 2, .5f, 4);
     XNAGame.Instance().space.Add(theBox3.body);
     XNAGame.Instance().children.Add(theBox3);
     theBox3.HasColor = true;
        // modelDrawer.Add(theBox3.body);
     return theBox3;
 }
Beispiel #3
0
 public BepuEntity createChassis(Vector3 position, float width, float height, float length)
 {
     BepuEntity theChasis = new BepuEntity();
           theChasis.modelName = "chassis7";
           theChasis.LoadContent();
           theChasis.localTransform = Matrix.CreateScale(new Vector3(width, height, length));
           theChasis.body = new Box(position, 20, 15, 60, 1);
           theChasis.configureEvents();
           XNAGame.Instance().space.Add(theChasis.body);
           XNAGame.Instance().children.Add(theChasis);
           return theChasis;
 }
Beispiel #4
0
 public BepuEntity createPiston1(Vector3 position, float pistonheight, float pistonradius)
 {
     BepuEntity theBox1 = new BepuEntity();
     theBox1.modelName = "slavepiston";
     theBox1.body = new Cylinder(position, .4f, .22f, 1);
        // theBox1.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
     theBox1.body.Orientation = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), MathHelper.PiOver2);
     XNAGame.Instance().space.Add(theBox1.body);
     XNAGame.Instance().children.Add(theBox1);
     theBox1.HasColor = true;
        // modelDrawer.Add(theBox1.body);
     return theBox1;
 }
Beispiel #5
0
        public BepuEntity createHub(Vector3 position, float hubheight, float hubradius)
        {
            BepuEntity theBox6 = new BepuEntity();
            theBox6.modelName = "hub";
            //  theBox.localTransform = Matrix.CreateScale(new Vector3(hubheight, hubradius));
            theBox6.body = new Cylinder(position, hubheight, hubradius, 1);
            theBox6.HasColor = true;
               // theBox.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
            theBox6.body.Orientation = Quaternion.CreateFromAxisAngle(new Vector3(0, 0, 1), MathHelper.PiOver2);
            XNAGame.Instance().space.Add(theBox6.body);
            XNAGame.Instance().children.Add(theBox6);

            // modelDrawer.Add(theBox.body);
            return theBox6;
        }
Beispiel #6
0
 public BepuEntity createWheel(Vector3 position, string mesh, float scale)
 {
     BepuEntity entity = new BepuEntity();
     entity.modelName = "Wheels7";
     entity.LoadContent();
     Vector3[] vertices;
     int[] indices;
     TriangleMesh.GetVerticesAndIndicesFromModel(entity.model, out vertices, out indices);
     AffineTransform localTransform = new AffineTransform(new Vector3(scale, scale, scale), Quaternion.Identity, new Vector3(0, 0, 0));
     MobileMesh mobileMesh = new MobileMesh(vertices, indices, localTransform, BEPUphysics.CollisionShapes.MobileMeshSolidity.Counterclockwise, 1);
     //Correct Scale for 'Wheels6:'
     //      entity.localTransform = Matrix.CreateScale(4.5f, 4.5f, 4.5f);
     entity.localTransform = Matrix.CreateScale(2.75f, 2.75f, 2.75f);
     entity.body = mobileMesh;
     entity.HasColor = true;
        entity.body.Position = position;
     XNAGame.Instance().space.Add(entity.body);
     XNAGame.Instance().children.Add(entity);
     //modelDrawer.Add(entity.body);
     return entity;
 }
Beispiel #7
0
        public BepuEntity createCylinder(Vector3 position, string mesh, float scale)
        {
            BepuEntity entity = new BepuEntity();
                  entity.modelName = "SlaveCylinder";
                  entity.LoadContent();
                  entity.Mass = 0;
                  Vector3[] vertices;
                  int[] indices;

                  TriangleMesh.GetVerticesAndIndicesFromModel(entity.model, out vertices, out indices);
                  AffineTransform localTransform = new AffineTransform(new Vector3(.4f, .4f, .4f), Quaternion.Identity, new Vector3(0, 0, 0));
                  MobileMesh mobileMesh = new MobileMesh(vertices, indices, localTransform, BEPUphysics.CollisionShapes.MobileMeshSolidity.Counterclockwise, 1);
                  entity.localTransform = Matrix.CreateScale(1f, 1f,1f);
                  entity.body = mobileMesh;
                  entity.HasColor = true;
                  entity.body.Position = position;
                  entity.body.Orientation = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), MathHelper.PiOver2);
                  XNAGame.Instance().space.Add(entity.body);
                  XNAGame.Instance().children.Add(entity);
                 // modelDrawer.Add(entity.body);
                  return entity;
        }