public void CreateRevoluteJoint(out RevoluteJoint joint, BepuEntity connectionA, BepuEntity connectionB, Vector3 anchor, int maxForce, Vector3 freeAxis)
 {
     //Creates joints for such things as camera/laser rotating around the body, or up and down
     joint = new RevoluteJoint(connectionA.body, connectionB.body, anchor, freeAxis);
     joint.Motor.IsActive              = true;
     joint.Motor.Settings.Mode         = MotorMode.Servomechanism;
     joint.Motor.Settings.MaximumForce = maxForce;
     Game1.Instance.Space.Add(joint);
 }
        public MarsRover() : base()
        {
            laserShot      = Game1.Instance.Content.Load <SoundEffect>("lasershot");
            explosionSound = Game1.Instance.Content.Load <SoundEffect>("explosion-01");
            cameraArm      = new BepuEntity();
            drillArm       = new BepuEntity();

            //construct mars rover ase body
            roverBase = marsRoverBody.AddBox(new Vector3(260, 45, -260));

            //create arms to hold both drill and camera/laser
            drillArm  = marsRoverBody.AddCylinder("cylinder", new Vector3(267, 44, -244), false);
            cameraArm = marsRoverBody.AddCylinder("cylinder", new Vector3(254, 54, -252), true);

            //Create joint between rover body and drill arm
            roverMovement.CreateRevoluteJoint(out roverMovement.bodyDrillJoint, roverBase, drillArm, new Vector3(267, 44, -250), 3500, Vector3.Right);
            roverMovement.roverJoints.Add(roverMovement.bodyDrillJoint);

            //Create joint between rover body and camera/laser arm
            roverMovement.CreateRevoluteJoint(out roverMovement.bodyCameraCylinderJoint, roverBase, cameraArm, cameraArm.body.Position, 1500, Vector3.Up);
            roverMovement.roverJoints.Add(roverMovement.bodyCameraCylinderJoint);

            //create container for camera/laser
            cameraLaserContainer = marsRoverBody.AddCylinder("cube", new Vector3(254, 61, -252), true);

            //Create joint between camera/laser arm and container for camera/laser
            roverMovement.CreateRevoluteJoint(out roverMovement.cameraLaserContainerXaxisRotation, cameraArm, cameraLaserContainer, cameraLaserContainer.body.Position, 2500, -Vector3.Right);
            roverMovement.roverJoints.Add(roverMovement.cameraLaserContainerXaxisRotation);

            //create the four back wheels of the rover and connect them to the body
            Entity backWheel1 = marsRoverBody.AddWheel(new Vector3(250, 42, -267), roverBase.body);

            roverMovement.ConnectWheelBody(backWheel1, roverBase);
            Entity backWheel2 = marsRoverBody.AddWheel(new Vector3(270, 42, -267), roverBase.body);

            roverMovement.ConnectWheelBody(backWheel2, roverBase);
            Entity backWheel3 = marsRoverBody.AddWheel(new Vector3(250, 42, -260), roverBase.body);

            roverMovement.ConnectWheelBody(backWheel3, roverBase);
            Entity backWheel4 = marsRoverBody.AddWheel(new Vector3(270, 42, -260), roverBase.body);

            roverMovement.ConnectWheelBody(backWheel4, roverBase);

            //Create the two driving wheels and connect them to the body
            var wheel1 = marsRoverBody.AddWheel(new Vector3(270, 42, -255), roverBase.body);

            roverMovement.SetUpFrontMotorWheels(roverBase, wheel1, out roverMovement.drivingMotor1, out roverMovement.steeringMotor1);
            var wheel2 = marsRoverBody.AddWheel(new Vector3(250, 42, -255), roverBase.body);

            roverMovement.SetUpFrontMotorWheels(roverBase, wheel2, out roverMovement.drivingMotor2, out roverMovement.steeringMotor2);

            var steeringStabilizer = new RevoluteAngularJoint(wheel1, wheel2, Vector3.Right);

            Game1.Instance.Space.Add(steeringStabilizer);
        }
        public void CreateSuspensionString(BepuEntity connectionA, Entity connectionB)
        {
            //code taken from bepu physics demo suspensioncardemo.cs and adapted for this project
            LinearAxisMotor suspensionSpring = new LinearAxisMotor(connectionA.body, connectionB, connectionB.Position, connectionB.Position, Vector3.Down);

            suspensionSpring.Settings.Mode       = MotorMode.Servomechanism;
            suspensionSpring.Settings.Servo.Goal = 0;
            suspensionSpring.Settings.Servo.SpringSettings.StiffnessConstant = 300;
            suspensionSpring.Settings.Servo.SpringSettings.DampingConstant   = 70;
            Game1.Instance.Space.Add(suspensionSpring);

            //my own code ,add joints to lists of joints for explosion
            suspensionSprings.Add(suspensionSpring);
        }
        public BepuEntity AddCylinder(string modelName, Vector3 Postion, bool Orientation)
        {
            BepuEntity cylinder = new BepuEntity();
            cylinder.modelName = modelName;
            cylinder.localTransform = Matrix.CreateScale(new Vector3(3, 3, 3));
            cylinder.body = new Cylinder(Postion, 3, 3, 3);
            cylinder.diffuse = new Vector3(0.5f, 0.5f, 0.5f);
            if (Orientation)//if cylinder needs to be rotated
                cylinder.body.Orientation = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), MathHelper.PiOver2);
            Game1.Instance.Space.Add(cylinder.body);
            Game1.Instance.Children.Add(cylinder);

            return cylinder;
        }
        MarsRoverMovement roverMovement = new MarsRoverMovement(); // creates the aspects of the rovers movement

        #endregion Fields

        #region Constructors

        public MarsRover()
            : base()
        {
            laserShot = Game1.Instance.Content.Load<SoundEffect>("lasershot");
            explosionSound = Game1.Instance.Content.Load<SoundEffect>("explosion-01");
            cameraArm = new BepuEntity();
            drillArm = new BepuEntity();

            //construct mars rover ase body
            roverBase = marsRoverBody.AddBox(new Vector3(260, 45, -260));

            //create arms to hold both drill and camera/laser
            drillArm = marsRoverBody.AddCylinder("cylinder", new Vector3(267, 44, -244), false);
            cameraArm = marsRoverBody.AddCylinder("cylinder", new Vector3(254, 54, -252), true);

            //Create joint between rover body and drill arm
            roverMovement.CreateRevoluteJoint(out roverMovement.bodyDrillJoint, roverBase, drillArm, new Vector3(267, 44, -250), 3500, Vector3.Right);
            roverMovement.roverJoints.Add(roverMovement.bodyDrillJoint);

            //Create joint between rover body and camera/laser arm
            roverMovement.CreateRevoluteJoint(out roverMovement.bodyCameraCylinderJoint, roverBase, cameraArm, cameraArm.body.Position, 1500, Vector3.Up);
            roverMovement.roverJoints.Add(roverMovement.bodyCameraCylinderJoint);

            //create container for camera/laser
            cameraLaserContainer = marsRoverBody.AddCylinder("cube", new Vector3(254, 61, -252), true);

            //Create joint between camera/laser arm and container for camera/laser
            roverMovement.CreateRevoluteJoint(out roverMovement.cameraLaserContainerXaxisRotation, cameraArm, cameraLaserContainer, cameraLaserContainer.body.Position, 2500, -Vector3.Right);
            roverMovement.roverJoints.Add(roverMovement.cameraLaserContainerXaxisRotation);

            //create the four back wheels of the rover and connect them to the body
            Entity backWheel1 = marsRoverBody.AddWheel(new Vector3(250, 42, -267), roverBase.body);
            roverMovement.ConnectWheelBody(backWheel1, roverBase);
            Entity backWheel2 = marsRoverBody.AddWheel(new Vector3(270, 42, -267), roverBase.body);
            roverMovement.ConnectWheelBody(backWheel2, roverBase);
            Entity backWheel3 = marsRoverBody.AddWheel(new Vector3(250, 42, -260), roverBase.body);
            roverMovement.ConnectWheelBody(backWheel3, roverBase);
            Entity backWheel4 = marsRoverBody.AddWheel(new Vector3(270, 42, -260), roverBase.body);
            roverMovement.ConnectWheelBody(backWheel4, roverBase);

            //Create the two driving wheels and connect them to the body
            var wheel1 = marsRoverBody.AddWheel(new Vector3(270, 42, -255), roverBase.body);
            roverMovement.SetUpFrontMotorWheels(roverBase, wheel1, out roverMovement.drivingMotor1, out roverMovement.steeringMotor1);
            var wheel2 = marsRoverBody.AddWheel(new Vector3(250, 42, -255), roverBase.body);
            roverMovement.SetUpFrontMotorWheels(roverBase, wheel2, out roverMovement.drivingMotor2, out roverMovement.steeringMotor2);

            var steeringStabilizer = new RevoluteAngularJoint(wheel1, wheel2, Vector3.Right);
            Game1.Instance.Space.Add(steeringStabilizer);
        }
Example #6
0
        void fireBall()
        {
            BepuEntity ball = new BepuEntity();

            ball.modelName = "sphere";
            float size = 1;

            ball.localTransform = Matrix.CreateScale(new Vector3(size, size, size));
            ball.body           = new Sphere(Camera.pos + (Camera.look * 5), size, size);
            ball.diffuse        = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
            space.Add(ball.body);
            ball.LoadContent();
            ball.body.ApplyImpulse(Vector3.Zero, Camera.look * 50);
            children.Add(ball);
        }
        public BepuEntity AddBox(Vector3 boxPosition)
        {
            BepuEntity body = new BepuEntity();
            body.modelName = "cube";
            body.LoadContent();
            body.localTransform = Matrix.CreateScale(new Vector3(15, 5, 20));
            body.body = new Box(new Vector3(260, 45, -260), 15, 5, 20);
            body.body.BecomeDynamic(100);
            body.body.CollisionInformation.LocalPosition = new Vector3(0, .8f, 0);
            body.diffuse = new Vector3(0.5f, 0.5f, 0.5f);
            Game1.Instance.Space.Add(body.body);
            Game1.Instance.Children.Add(body);

            return body;
        }
Example #8
0
        public BepuEntity AddBox(Vector3 boxPosition)
        {
            BepuEntity body = new BepuEntity();

            body.modelName = "cube";
            body.LoadContent();
            body.localTransform = Matrix.CreateScale(new Vector3(15, 5, 20));
            body.body           = new Box(new Vector3(260, 45, -260), 15, 5, 20);
            body.body.BecomeDynamic(100);
            body.body.CollisionInformation.LocalPosition = new Vector3(0, .8f, 0);
            body.diffuse = new Vector3(0.5f, 0.5f, 0.5f);
            Game1.Instance.Space.Add(body.body);
            Game1.Instance.Children.Add(body);

            return(body);
        }
Example #9
0
        public BepuEntity AddCylinder(string modelName, Vector3 Postion, bool Orientation)
        {
            BepuEntity cylinder = new BepuEntity();

            cylinder.modelName      = modelName;
            cylinder.localTransform = Matrix.CreateScale(new Vector3(3, 3, 3));
            cylinder.body           = new Cylinder(Postion, 3, 3, 3);
            cylinder.diffuse        = new Vector3(0.5f, 0.5f, 0.5f);
            if (Orientation)//if cylinder needs to be rotated
            {
                cylinder.body.Orientation = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), MathHelper.PiOver2);
            }
            Game1.Instance.Space.Add(cylinder.body);
            Game1.Instance.Children.Add(cylinder);

            return(cylinder);
        }
        public void ConnectWheelBody(Entity backWheel, BepuEntity roverBody)
        {
            //code taken from bepu physics demo suspensioncardemo.cs and adapted for this project
            PointOnLineJoint pointOnLineJoint = new PointOnLineJoint(roverBody.body, backWheel, backWheel.Position, Vector3.Down, backWheel.Position);
            LinearAxisLimit  suspensionLimit  = new LinearAxisLimit(roverBody.body, backWheel, backWheel.Position, backWheel.Position, Vector3.Down, -1, 0);

            CreateSuspensionString(roverBody, backWheel);

            RevoluteAngularJoint revoluteAngularJoint = new RevoluteAngularJoint(roverBody.body, backWheel, Vector3.Right);

            Game1.Instance.Space.Add(pointOnLineJoint);
            Game1.Instance.Space.Add(suspensionLimit);
            Game1.Instance.Space.Add(revoluteAngularJoint);

            //my own code ,add joints to lists of joints for explosionn
            joints.Add(pointOnLineJoint);
            joints.Add(suspensionLimit);
            joints.Add(revoluteAngularJoint);
        }
        public void SetUpFrontMotorWheels(BepuEntity roverBody, Entity wheel1, out RevoluteMotor drivingMotor, out RevoluteMotor steeringMotor)
        {
            //code taken from bepu physics demo suspensioncardemo.cs and adapted for this project
            PointOnLineJoint pointOnLineJoint = new PointOnLineJoint(roverBody.body, wheel1, wheel1.Position, Vector3.Down, wheel1.Position);
            LinearAxisLimit  suspensionLimit  = new LinearAxisLimit(roverBody.body, wheel1, wheel1.Position, wheel1.Position, Vector3.Down, -1, 0);

            CreateSuspensionString(roverBody, wheel1);

            SwivelHingeAngularJoint swivelHingeAngularJoint = new SwivelHingeAngularJoint(roverBody.body, wheel1, Vector3.Up, Vector3.Right);

            swivelHingeAngularJoint.SpringSettings.DampingConstant   *= 1000;
            swivelHingeAngularJoint.SpringSettings.StiffnessConstant *= 1000;

            drivingMotor = new RevoluteMotor(roverBody.body, wheel1, -Vector3.Left);
            drivingMotor.Settings.VelocityMotor.Softness = .3f;
            drivingMotor.Settings.MaximumForce           = 100;
            drivingMotor.IsActive = false;

            steeringMotor = new RevoluteMotor(roverBody.body, wheel1, Vector3.Up);
            steeringMotor.Settings.Mode = MotorMode.Servomechanism;
            steeringMotor.Basis.SetWorldAxes(Vector3.Up, Vector3.Right);
            steeringMotor.TestAxis = Vector3.Right;
            steeringMotor.Settings.Servo.SpringSettings.Advanced.UseAdvancedSettings  = true;
            steeringMotor.Settings.Servo.SpringSettings.Advanced.Softness             = 0;
            steeringMotor.Settings.Servo.SpringSettings.Advanced.ErrorReductionFactor = 0f;

            var steeringConstraint = new RevoluteLimit(roverBody.body, wheel1, Vector3.Up, Vector3.Right, -maximumTurnAngle, maximumTurnAngle);

            Game1.Instance.Space.Add(pointOnLineJoint);
            Game1.Instance.Space.Add(suspensionLimit);
            Game1.Instance.Space.Add(swivelHingeAngularJoint);
            Game1.Instance.Space.Add(drivingMotor);
            Game1.Instance.Space.Add(steeringMotor);
            Game1.Instance.Space.Add(steeringConstraint);

            //my own code ,add joints to lists of joints for explosion
            joints.Add(pointOnLineJoint);
            joints.Add(suspensionLimit);
            joints.Add(swivelHingeAngularJoint);
            motors.Add(drivingMotor);
            motors.Add(steeringMotor);
        }
        public Entity AddWheel(Vector3 wheelPosition, Entity baseBody)
        {
            BepuEntity wheel = new BepuEntity();
            wheel.modelName = "cyl";
            wheel.LoadContent();
            wheel.body = new Cylinder(wheelPosition, 2, 2, 2);
            wheel.localTransform = Matrix.CreateScale(2f, 2f, 2f);
            wheel.body.Material.KineticFriction = 2.5f;
            wheel.body.Material.StaticFriction = 2.5f;
            wheel.body.Orientation = Quaternion.CreateFromAxisAngle(Vector3.Forward, MathHelper.PiOver2);
            wheel.diffuse = new Vector3(0, 0, 0);

            //Prevents collisionf from happening
            CollisionRules.AddRule(wheel.body, baseBody, CollisionRule.NoBroadPhase);

            //Add the wheel and connection to the space.
            Game1.Instance.Space.Add(wheel.body);
            Game1.Instance.Children.Add(wheel);

            return wheel.body;
        }
Example #13
0
        public Entity AddWheel(Vector3 wheelPosition, Entity baseBody)
        {
            BepuEntity wheel = new BepuEntity();

            wheel.modelName = "cyl";
            wheel.LoadContent();
            wheel.body           = new Cylinder(wheelPosition, 2, 2, 2);
            wheel.localTransform = Matrix.CreateScale(2f, 2f, 2f);
            wheel.body.Material.KineticFriction = 2.5f;
            wheel.body.Material.StaticFriction  = 2.5f;
            wheel.body.Orientation = Quaternion.CreateFromAxisAngle(Vector3.Forward, MathHelper.PiOver2);
            wheel.diffuse          = new Vector3(0, 0, 0);

            //Prevents collisionf from happening
            CollisionRules.AddRule(wheel.body, baseBody, CollisionRule.NoBroadPhase);

            //Add the wheel and connection to the space.
            Game1.Instance.Space.Add(wheel.body);
            Game1.Instance.Children.Add(wheel);

            return(wheel.body);
        }
 void fireBall()
 {
     BepuEntity ball = new BepuEntity();
     ball.modelName = "sphere";
     float size = 1;
     ball.localTransform = Matrix.CreateScale(new Vector3(size, size, size));
     ball.body = new Sphere(Camera.pos + (Camera.look * 5), size, size);
     ball.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
     space.Add(ball.body);
     ball.LoadContent();
     ball.body.ApplyImpulse(Vector3.Zero, Camera.look * 50);
     children.Add(ball);
 }
        public override void LoadContent()
        {
            BepuEntity boxBase = new BepuEntity();
            boxBase.modelName = "cube";
            boxBase.localTransform = Matrix.CreateScale(new Vector3(20, 5, 20));
            boxBase.body = new Box(new Vector3(5, 1, 0), 20, 5, 20, 1);
            boxBase.body.BecomeKinematic();
            boxBase.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
            Game1.Instance.Space.Add(boxBase.body);

            Game1.Instance.Children.Add(boxBase);

               BepuEntity armBase = new BepuEntity();
               armBase.modelName = "cylinder";
               armBase.localTransform = Matrix.CreateScale(new Vector3(2.5f, 2, 5));
               armBase.body= new Cylinder(new Vector3(15, 2, 20), 2.5f, 2, 1);
               Game1.Instance.Space.Add(armBase.body);

               Game1.Instance.Children.Add(armBase);
               hinge = new RevoluteJoint(boxBase.body, armBase.body, new Vector3(10, 1.5f, 10), new Vector3(0, 1, 0));
               hinge.Motor.IsActive = true;
               hinge.Motor.Settings.Mode = BEPUphysics.Constraints.TwoEntity.Motors.MotorMode.Servomechanism;
               hinge.Motor.Settings.MaximumForce = 3500;

               BepuEntity armPart2 = new BepuEntity();
               armPart2.modelName = "cylinder2";
               armPart2.localTransform = Matrix.CreateScale(new Vector3(2.5f, 2, 5));
               armPart2.body = new Cylinder(new Vector3(15, 2, 31), 2.5f, 2, 1);
               armPart2.body.Orientation = Quaternion.CreateFromAxisAngle(new Vector3(1,0,0),90);
               Game1.Instance.Space.Add(armPart2.body);

               Game1.Instance.Children.Add(armPart2);

               Game1.Instance.Space.Add(hinge);
               hinge2 = new RevoluteJoint(armBase.body, armPart2.body,armBase.pos, new Vector3(1, 0, 0));
               hinge2.Motor.IsActive = true;
               hinge2.Motor.Settings.Mode = BEPUphysics.Constraints.TwoEntity.Motors.MotorMode.Servomechanism;
               hinge2.Motor.Settings.MaximumForce = 3500;
               Game1.Instance.Space.Add(hinge2);

               BepuEntity wheel = new BepuEntity();
               wheel.modelName = "wheel";
               wheel.localTransform = Matrix.CreateScale(new Vector3(3, 3, 3));
               wheel.body = new Cylinder(new Vector3(35, 5, 31), 2.5f, 0, 1);
               wheel.body.BecomeKinematic();
               wheel.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
               Game1.Instance.Space.Add(wheel.body);

               BepuEntity wheel2 = new BepuEntity();
               wheel2.modelName = "wheel";
               wheel2.localTransform = Matrix.CreateScale(new Vector3(3, 3, 3));
               wheel2.body = new Cylinder(new Vector3(50, 5, 31), 2.5f, 0, 1);
               wheel2.body.BecomeKinematic();
               wheel2.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
               Game1.Instance.Space.Add(wheel2.body);

               BepuEntity wheel3 = new BepuEntity();
               wheel3.modelName = "wheel";
               wheel3.localTransform = Matrix.CreateScale(new Vector3(3, 3, 3));
               wheel3.body = new Cylinder(new Vector3(35, 5, 21), 2.5f, 0, 1);
               wheel3.body.BecomeKinematic();
               wheel3.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
               Game1.Instance.Space.Add(wheel3.body);

               BepuEntity wheel4 = new BepuEntity();
               wheel4.modelName = "wheel";
               wheel4.localTransform = Matrix.CreateScale(new Vector3(3, 3, 3));
               wheel4.body = new Cylinder(new Vector3(50, 5, 21), 2.5f, 0, 1);
               wheel4.body.BecomeKinematic();
               wheel4.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
               Game1.Instance.Space.Add(wheel4.body);

               Game1.Instance.Children.Add(wheel);
               Game1.Instance.Children.Add(wheel2);
               Game1.Instance.Children.Add(wheel3);
               Game1.Instance.Children.Add(wheel4);

               BepuEntity boxBase2 = new BepuEntity();
               boxBase2.modelName = "cube";
               boxBase2.localTransform = Matrix.CreateScale(new Vector3(20, 5, 20));
               boxBase2.body = new Box(new Vector3(45, 10, 25), 20, 5, 20, 1);
               //boxBase2.body.BecomeKinematic();
               boxBase2.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
               Game1.Instance.Space.Add(boxBase2.body);
               Game1.Instance.Children.Add(boxBase2);

               wheelJoint1 = new RevoluteJoint(boxBase2.body, wheel.body, new Vector3(35, 5, 31), new Vector3(0, 0, 1));
               Game1.Instance.Space.Add(wheelJoint1);

               wheelJoint2 = new RevoluteJoint(boxBase2.body, wheel2.body, new Vector3(50, 5, 31), new Vector3(0, 0, 1));
               Game1.Instance.Space.Add(wheelJoint2);

               wheelJoint3 = new RevoluteJoint(boxBase2.body, wheel3.body, new Vector3(35, 5, 21), new Vector3(0, 0, 1));
               Game1.Instance.Space.Add(wheelJoint3);

               wheelJoint4 = new RevoluteJoint(boxBase2.body, wheel4.body, new Vector3(50, 5, 21), new Vector3(0, 0, 1));
               Game1.Instance.Space.Add(wheelJoint4);
        }
Example #16
0
        public override void LoadContent()
        {
            BepuEntity boxBase = new BepuEntity();

            boxBase.modelName      = "cube";
            boxBase.localTransform = Matrix.CreateScale(new Vector3(20, 5, 20));
            boxBase.body           = new Box(new Vector3(5, 1, 0), 20, 5, 20, 1);
            boxBase.body.BecomeKinematic();
            boxBase.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
            Game1.Instance.Space.Add(boxBase.body);

            Game1.Instance.Children.Add(boxBase);

            BepuEntity armBase = new BepuEntity();

            armBase.modelName      = "cylinder";
            armBase.localTransform = Matrix.CreateScale(new Vector3(2.5f, 2, 5));
            armBase.body           = new Cylinder(new Vector3(15, 2, 20), 2.5f, 2, 1);
            Game1.Instance.Space.Add(armBase.body);

            Game1.Instance.Children.Add(armBase);
            hinge = new RevoluteJoint(boxBase.body, armBase.body, new Vector3(10, 1.5f, 10), new Vector3(0, 1, 0));
            hinge.Motor.IsActive              = true;
            hinge.Motor.Settings.Mode         = BEPUphysics.Constraints.TwoEntity.Motors.MotorMode.Servomechanism;
            hinge.Motor.Settings.MaximumForce = 3500;

            BepuEntity armPart2 = new BepuEntity();

            armPart2.modelName        = "cylinder2";
            armPart2.localTransform   = Matrix.CreateScale(new Vector3(2.5f, 2, 5));
            armPart2.body             = new Cylinder(new Vector3(15, 2, 31), 2.5f, 2, 1);
            armPart2.body.Orientation = Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), 90);
            Game1.Instance.Space.Add(armPart2.body);

            Game1.Instance.Children.Add(armPart2);

            Game1.Instance.Space.Add(hinge);
            hinge2 = new RevoluteJoint(armBase.body, armPart2.body, armBase.pos, new Vector3(1, 0, 0));
            hinge2.Motor.IsActive              = true;
            hinge2.Motor.Settings.Mode         = BEPUphysics.Constraints.TwoEntity.Motors.MotorMode.Servomechanism;
            hinge2.Motor.Settings.MaximumForce = 3500;
            Game1.Instance.Space.Add(hinge2);

            BepuEntity wheel = new BepuEntity();

            wheel.modelName      = "wheel";
            wheel.localTransform = Matrix.CreateScale(new Vector3(3, 3, 3));
            wheel.body           = new Cylinder(new Vector3(35, 5, 31), 2.5f, 0, 1);
            wheel.body.BecomeKinematic();
            wheel.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
            Game1.Instance.Space.Add(wheel.body);

            BepuEntity wheel2 = new BepuEntity();

            wheel2.modelName      = "wheel";
            wheel2.localTransform = Matrix.CreateScale(new Vector3(3, 3, 3));
            wheel2.body           = new Cylinder(new Vector3(50, 5, 31), 2.5f, 0, 1);
            wheel2.body.BecomeKinematic();
            wheel2.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
            Game1.Instance.Space.Add(wheel2.body);

            BepuEntity wheel3 = new BepuEntity();

            wheel3.modelName      = "wheel";
            wheel3.localTransform = Matrix.CreateScale(new Vector3(3, 3, 3));
            wheel3.body           = new Cylinder(new Vector3(35, 5, 21), 2.5f, 0, 1);
            wheel3.body.BecomeKinematic();
            wheel3.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
            Game1.Instance.Space.Add(wheel3.body);

            BepuEntity wheel4 = new BepuEntity();

            wheel4.modelName      = "wheel";
            wheel4.localTransform = Matrix.CreateScale(new Vector3(3, 3, 3));
            wheel4.body           = new Cylinder(new Vector3(50, 5, 21), 2.5f, 0, 1);
            wheel4.body.BecomeKinematic();
            wheel4.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
            Game1.Instance.Space.Add(wheel4.body);

            Game1.Instance.Children.Add(wheel);
            Game1.Instance.Children.Add(wheel2);
            Game1.Instance.Children.Add(wheel3);
            Game1.Instance.Children.Add(wheel4);

            BepuEntity boxBase2 = new BepuEntity();

            boxBase2.modelName      = "cube";
            boxBase2.localTransform = Matrix.CreateScale(new Vector3(20, 5, 20));
            boxBase2.body           = new Box(new Vector3(45, 10, 25), 20, 5, 20, 1);
            //boxBase2.body.BecomeKinematic();
            boxBase2.diffuse = new Vector3((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());
            Game1.Instance.Space.Add(boxBase2.body);
            Game1.Instance.Children.Add(boxBase2);

            wheelJoint1 = new RevoluteJoint(boxBase2.body, wheel.body, new Vector3(35, 5, 31), new Vector3(0, 0, 1));
            Game1.Instance.Space.Add(wheelJoint1);

            wheelJoint2 = new RevoluteJoint(boxBase2.body, wheel2.body, new Vector3(50, 5, 31), new Vector3(0, 0, 1));
            Game1.Instance.Space.Add(wheelJoint2);

            wheelJoint3 = new RevoluteJoint(boxBase2.body, wheel3.body, new Vector3(35, 5, 21), new Vector3(0, 0, 1));
            Game1.Instance.Space.Add(wheelJoint3);

            wheelJoint4 = new RevoluteJoint(boxBase2.body, wheel4.body, new Vector3(50, 5, 21), new Vector3(0, 0, 1));
            Game1.Instance.Space.Add(wheelJoint4);
        }