Beispiel #1
0
        public Car(World world, Vector2 position, float orientation)
        {
            float rearAxleDist = -WHEEL_POS_LR.X;
            position += new Vector2((float)Math.Cos(orientation) * rearAxleDist, (float)Math.Sin(orientation) * rearAxleDist);
            Body = BodyFactory.CreateRectangle(world, HALF_CAR_LENGTH * 2, HALF_CAR_WIDTH * 2, CHASSIS_DENSITY, position);
            Body.BodyType = BodyType.Dynamic;
            Body.Friction = FRICTION;
            Body.Restitution = RESTITUTION;
            Body.AngularDamping = ANGULAR_DAMPING;
            Body.Rotation = orientation;

            Wheels = new WheelSet(world, this, position, orientation);
            this.world = world;
        }
Beispiel #2
0
        public Car(World world, Vector2 position, float orientation)
        {
            float rearAxleDist = -WHEEL_POS_LR.X;

            position           += new Vector2((float)Math.Cos(orientation) * rearAxleDist, (float)Math.Sin(orientation) * rearAxleDist);
            Body                = BodyFactory.CreateRectangle(world, HALF_CAR_LENGTH * 2, HALF_CAR_WIDTH * 2, CHASSIS_DENSITY, position);
            Body.BodyType       = BodyType.Dynamic;
            Body.Friction       = FRICTION;
            Body.Restitution    = RESTITUTION;
            Body.AngularDamping = ANGULAR_DAMPING;
            Body.Rotation       = orientation;

            Wheels     = new WheelSet(world, this, position, orientation);
            this.world = world;
        }