Search Unity

How to rotate 90° the Wheel Collider in the Y to align it along the X axis?

Discussion in 'Physics' started by AlanMattano, Aug 22, 2015.

  1. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Wheel Collider is oriented aligned to be used along the Z axis by default.

    Is it possible to rotate 90° the Wheel Collider in the Y to align it along the X axis?


    My Models are oriented along the X axis and not in the Z axis as the Wheel Collier. When i attache the wheel collider is not align properly. If i rotate the Game object of the wheel collier, the wheel collier do not rotate. Is this a bug? If I rotate my model (main parent game object) the wheel rotates with it and remain 90° to the model.

    Using Unity 5.2.0f2

    What can i do to resolve the problem?
     
    Last edited: Aug 22, 2015
  2. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Solution using WheelCollider.steerAngle

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class WheelRotation : MonoBehaviour
    5. {
    6.     // drag and drop the the wheel collider game object into the slot in the inspector
    7.     public WheelCollider wheelGameObject;
    8.     public float angle;    // assign correct angle in the inspector (90°)
    9.  
    10.     void Awake ()
    11.     {
    12.         wheelGameObject.steerAngle = angle;
    13.     }
    14. }
     
    Last edited: Aug 24, 2015
  3. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    That's a correct solution. Please be aware that WheelColliders are set to support rotations in a future Unity upgrade, so you might be able to remove this workaround.
     
  4. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Thanks Edy! do you know where i can follow this particular improvement?
    Is there a issue tracker or feedback link?
     
    Last edited: Aug 25, 2015
  5. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    I'm aware that there is an issue tracker entry about this, but I might be private as I haven't been able to find it again. I'd keep looking at the release notes for new Unity 3D versions and patches.
     
  6. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Thx 4 reply