예제 #1
0
        public CarObject(Game game, Model model,Model wheels, bool FWDrive,
                       bool RWDrive,
                       float maxSteerAngle,
                       float steerRate,
                       float wheelSideFriction,
                       float wheelFwdFriction,
                       float wheelTravel,
                       float wheelRadius,
                       float wheelZOffset,
                       float wheelRestingFrac,
                       float wheelDampingFrac,
                       int wheelNumRays,
                       float driveTorque,
                       float gravity)
            : base(game, model)
        {
            car = new Car(FWDrive, RWDrive, maxSteerAngle, steerRate,
                wheelSideFriction, wheelFwdFriction, wheelTravel, wheelRadius,
                wheelZOffset, wheelRestingFrac, wheelDampingFrac,
                wheelNumRays, driveTorque, gravity);

            this.body = car.Chassis.Body;
            this.collision = car.Chassis.Skin;
            this.wheel = wheels;

            SetCarMass(100.0f);
        }
예제 #2
0
        public CarObject(int asset,
            Vector3 pos,
            Model model,Model wheels, bool FWDrive,
                       bool RWDrive,
                       float maxSteerAngle,
                       float steerRate,
                       float wheelSideFriction,
                       float wheelFwdFriction,
                       float wheelTravel,
                       float wheelRadius,
                       float wheelZOffset,
                       float wheelRestingFrac,
                       float wheelDampingFrac,
                       int wheelNumRays,
                       float driveTorque,
                       float gravity)
            : base()
        {
            car = new Car(FWDrive, RWDrive, maxSteerAngle, steerRate,
                wheelSideFriction, wheelFwdFriction, wheelTravel, wheelRadius,
                wheelZOffset, wheelRestingFrac, wheelDampingFrac,
                wheelNumRays, driveTorque, gravity);

            this.Body = car.Chassis.Body;
            this.Skin= car.Chassis.Skin;
            Body.CollisionSkin = Skin;
            Body.ExternalData = this;
            this.wheel = wheels;
            CommonInit(pos, new Vector3(1, 1, 1), model, true, asset);
            SetCarMass(100.1f);

            actionManager.AddBinding((int)Actions.Acceleration, new Helper.Input.ActionBindingDelegate(SimulateAcceleration), 1);
            actionManager.AddBinding((int)Actions.Steering, new Helper.Input.ActionBindingDelegate(SimulateSteering), 1);
            actionManager.AddBinding((int)Actions.Handbrake, new Helper.Input.ActionBindingDelegate(SimulateHandbrake), 1);
        }
예제 #3
0
        public CarObject(Vector3 pos,
            Model model,Model wheels, bool FWDrive,
                       bool RWDrive,
                       float maxSteerAngle,
                       float steerRate,
                       float wheelSideFriction,
                       float wheelFwdFriction,
                       float wheelTravel,
                       float wheelRadius,
                       float wheelZOffset,
                       float wheelRestingFrac,
                       float wheelDampingFrac,
                       int wheelNumRays,
                       float driveTorque,
                       float gravity)
            : base()
        {
            car = new Car(FWDrive, RWDrive, maxSteerAngle, steerRate,
                wheelSideFriction, wheelFwdFriction, wheelTravel, wheelRadius,
                wheelZOffset, wheelRestingFrac, wheelDampingFrac,
                wheelNumRays, driveTorque, gravity);

            this.Body = car.Chassis.Body;
            this.Skin= car.Chassis.Skin;
            Body.CollisionSkin = Skin;
            Body.ExternalData = this;
            this.wheel = wheels;
            CommonInit(pos, new Vector3(1, 1, 1), model, true);
            SetCarMass(1.0f);
        }
예제 #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="car"></param>
        public Chassis(Car car)
        {
            body = new ChassisBody(car);
            collisionSkin = new CollisionSkin(body);

            body.CollisionSkin = collisionSkin;

            float length = 6.0f;
            float width = 2.3f;
            float height = 1.6f;

            Vector3 min = new Vector3(-0.5f * length, 0.0f, -width * 0.5f);
            Vector3 max = new Vector3(0.5f * length, height, width * 0.5f);

            SetDims(min, max);
        }
예제 #5
0
파일: Wheel.cs 프로젝트: bradleat/trafps
        public void Setup(Car car,
            Vector3 pos, ///< position relative to car, in car's space
            Vector3 axisUp, ///< in car's space
            float spring,  ///< force per suspension offset
            float travel,  ///< suspension travel upwards
            float inertia, ///< inertia about the axel
            float radius,
            float sideFriction,
            float fwdFriction,
            float damping,
            int numRays)
        {
            this.car = car;
            this.pos = pos;
            this.axisUp = axisUp;
            this.spring = spring;
            this.travel = travel;
            this.inertia = inertia;
            this.radius = radius;
            this.sideFriction = sideFriction;
            this.fwdFriction = fwdFriction;
            this.damping = damping;
            this.numRays = numRays;

            pred = new WheelPred(car.Chassis.Body.CollisionSkin);

            Reset();
        }
예제 #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="car"></param>
 public ChassisBody(Car car)
 {
     mCar = car;
 }