Exemple #1
0
    public void Start()
    {
        freezePos = this.transform.position;
        freezeRot = this.transform.rotation;
        freeze();
        boostAmount     = maxBoost;
        FrontRightWheel = FrontRight.gameObject.AddComponent <WheelColliderSource>();
        FrontLeftWheel  = FrontLeft.gameObject.AddComponent <WheelColliderSource>();
        BackRightWheel  = BackRight.gameObject.AddComponent <WheelColliderSource>();
        BackLeftWheel   = BackLeft.gameObject.AddComponent <WheelColliderSource>();
        //GameObject
        //FrontRight.gameObject.
        //Debug.Log("Wheel Radius = " + WheelRadius);
        FrontRightWheel.WheelRadius = FrontWheelRadius;
        FrontLeftWheel.WheelRadius  = FrontWheelRadius;
        BackRightWheel.WheelRadius  = BackWheelRadius;
        BackLeftWheel.WheelRadius   = BackWheelRadius;

        FrontRightWheel.SuspensionDistance = SuspensionDistance;
        FrontLeftWheel.SuspensionDistance  = SuspensionDistance;
        BackRightWheel.SuspensionDistance  = SuspensionDistance;
        BackLeftWheel.SuspensionDistance   = SuspensionDistance;

        rb = GetComponent <Rigidbody>();
        rb.centerOfMass = rb.centerOfMass - (Vector3.up * 0.5f);
    }
Exemple #2
0
    public void Start()
    {
        freezePos = this.transform.position;
        freezeRot = this.transform.rotation;
        freeze();
        boostAmount = maxBoost;
        FrontRightWheel = FrontRight.gameObject.AddComponent<WheelColliderSource>();
        FrontLeftWheel = FrontLeft.gameObject.AddComponent<WheelColliderSource>();
        BackRightWheel = BackRight.gameObject.AddComponent<WheelColliderSource>();
        BackLeftWheel = BackLeft.gameObject.AddComponent<WheelColliderSource>();
        //GameObject
        //FrontRight.gameObject.
        //Debug.Log("Wheel Radius = " + WheelRadius);
        FrontRightWheel.WheelRadius = FrontWheelRadius;
        FrontLeftWheel.WheelRadius = FrontWheelRadius;
        BackRightWheel.WheelRadius = BackWheelRadius;
        BackLeftWheel.WheelRadius = BackWheelRadius;

        FrontRightWheel.SuspensionDistance = SuspensionDistance;
        FrontLeftWheel.SuspensionDistance = SuspensionDistance;
        BackRightWheel.SuspensionDistance = SuspensionDistance;
        BackLeftWheel.SuspensionDistance = SuspensionDistance;

        rb = GetComponent<Rigidbody>();
        rb.centerOfMass = rb.centerOfMass - (Vector3.up * 0.5f);
    }