Exemple #1
0
        public WheelSet(World world, Car car, Vector2 position, float orientation)
        {
            Matrix rotation = Matrix.CreateRotationZ(orientation);

            LeftFront  = new RevoluteWheel(world, car, position + Vector2.Transform(Car.WHEEL_POS_LF, rotation), orientation);
            RightFront = new RevoluteWheel(world, car, position + Vector2.Transform(Car.WHEEL_POS_RF, rotation), orientation);
            LeftRear   = new FixedWheel(world, car, position + Vector2.Transform(Car.WHEEL_POS_LR, rotation), Car.WHEEL_POS_LR, orientation);
            RightRear  = new FixedWheel(world, car, position + Vector2.Transform(Car.WHEEL_POS_RR, rotation), Car.WHEEL_POS_RR, orientation);

            Controller = new TensorDampingController();
            Controller.SetAxisAligned(0, 100);
            Controller.AddBody(LeftFront.Body);
            Controller.AddBody(RightFront.Body);
            Controller.AddBody(LeftRear.Body);
            Controller.AddBody(RightRear.Body);

            world.AddController(Controller);
        }
Exemple #2
0
        public WheelSet(World world, Car car, Vector2 position, float orientation)
        {
            Matrix rotation = Matrix.CreateRotationZ(orientation);

            LeftFront = new RevoluteWheel(world, car, position + Vector2.Transform(Car.WHEEL_POS_LF, rotation), orientation);
            RightFront = new RevoluteWheel(world, car, position + Vector2.Transform(Car.WHEEL_POS_RF, rotation), orientation);
            LeftRear = new FixedWheel(world, car, position + Vector2.Transform(Car.WHEEL_POS_LR, rotation), Car.WHEEL_POS_LR, orientation);
            RightRear = new FixedWheel(world, car, position + Vector2.Transform(Car.WHEEL_POS_RR, rotation), Car.WHEEL_POS_RR, orientation);

            Controller = new TensorDampingController();
            Controller.SetAxisAligned(0, 100);
            Controller.AddBody(LeftFront.Body);
            Controller.AddBody(RightFront.Body);
            Controller.AddBody(LeftRear.Body);
            Controller.AddBody(RightRear.Body);

            world.AddController(Controller);
        }