WheelCollider - WheelMesh rotation bug

Hi!
I was learning about WheelColliders, I’ve tried to make some CarController from YT tutorial, but while doing all of them I had the same issue. WheelColliders are looking well, but the WheelMeshes are being rotated badly. The following code snippet is from that tutorial (if anyone cares): Unity 5 - Car Wheel Collider Tutorial + Blender Meshes - YouTube

public class CarController : MonoBehaviour 
{
    public WheelCollider[] wheelColliders = new WheelCollider[4];
    public Transform[] wheelMeshes = new Transform[4];

    void UpdateMeshesPositions()
    {
        for (int i = 0; i < 4; i++)
        {
            Quaternion quat;
            Vector3 pos;
            wheelColliders*.GetWorldPose(out pos,out quat);*

wheelMeshes*.transform.position = pos;*
wheelMeshes*.transform.rotation = quat;*
}
}

void FixedUpdate()
{
UpdateMeshesPositions();
}
}
The result of running that Script is on the attache Image.
[72614-wheelcolliderissue.png|72614]
I don’t know what is making that bug, is this WheelCollider Component’s fault or something else?
How can I fix this?
I would be very grateful for any help or advice!
I would be

Yes, because that's what happens when two objects collide. Make the mass of your projectile smaller if you want it to apply less force.

1 Answer

1

first you should X,Y,Z and pivot tire mesh in your 3D software to adjust for unity and then create A game object at same position each wheel , and game object to be parent of mesh tire. also u should assign wheelcollider to the Game object instead of tire mesh

By the way, do you know how to ignore a tag when using OnCollision? Something like: function OnCollisionEnter (Collision : Collision) { if (Collision.gameObject.tag == "Aim") { Ignore.Object } } Something lik ethis.