Example #1
0
    void ConfigureAxle(VPAxle axle, int leftWheelIndex, int rightWheelIndex, TireFrictionBase tireFriction)
    {
        WheelState leftWheelState  = wheelState[leftWheelIndex];
        WheelState rightWheelState = wheelState[rightWheelIndex];
        Wheel      leftWheelBlock  = wheels[leftWheelIndex];
        Wheel      rightWheelBlock = wheels[rightWheelIndex];

        bool isSteeringAxle = axle.steeringMode != Steering.SteeringMode.Disabled;

        // Configure the mandatory data per wheel

        ConfigureWheelData(leftWheelState, leftWheelBlock, axle.leftWheel, tireFriction, isSteeringAxle);
        ConfigureWheelData(rightWheelState, rightWheelBlock, axle.rightWheel, tireFriction, isSteeringAxle);

        // Configure steering

        if (isSteeringAxle)
        {
            m_steering.AddWheel(leftWheelState, GetWheelLocalPosition(axle.leftWheel), axle.steeringMode, axle.steeringRatio);
            m_steering.AddWheel(rightWheelState, GetWheelLocalPosition(axle.rightWheel), axle.steeringMode, axle.steeringRatio);
        }
    }