示例#1
0
    void Update()
    {
        return;

        this.steerInput = Input.GetAxis("Horizontal");

        if (this.steerInput > 0)
        {
            this.ackermannAngleLeft  = TSMath.Rad2Deg * TSMath.Atan(this.wheelBase / (this.turnRadius + (this.rearTrack / 2))) * this.steerInput;
            this.ackermannAngleRight = TSMath.Rad2Deg * TSMath.Atan(this.wheelBase / (this.turnRadius - (this.rearTrack / 2))) * this.steerInput;
        }
        else if (this.steerInput < 0)
        {
            this.ackermannAngleLeft  = TSMath.Rad2Deg * TSMath.Atan(this.wheelBase / (this.turnRadius - (this.rearTrack / 2))) * this.steerInput;
            this.ackermannAngleRight = TSMath.Rad2Deg * TSMath.Atan(this.wheelBase / (this.turnRadius + (this.rearTrack / 2))) * this.steerInput;
        }
        else
        {
            this.ackermannAngleLeft  = 0;
            this.ackermannAngleRight = 0;
        }

        foreach (var item in this.wheels)
        {
            switch (item.WheelPosition)
            {
            case WheelPosition.FrontLeft:
                item.steerAngle = this.ackermannAngleLeft;
                break;

            case WheelPosition.FrontRigth:
                item.steerAngle = this.ackermannAngleRight;
                break;

            case WheelPosition.RearLeft:
                break;

            case WheelPosition.RearRigth:
                break;

            default:
                break;
            }
        }
    }