Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

car is pulling to the right!

Discussion in 'Editor & General Support' started by an3d, Aug 19, 2010.

  1. an3d

    an3d

    Joined:
    Feb 24, 2010
    Posts:
    52
    Hello all,

    I'm stuck here....set up my car but it is pulling to the right...anybody ideas!

    thanks
     
  2. JRavey

    JRavey

    Joined:
    May 12, 2009
    Posts:
    2,377
    After carefully reviewing all of the code you shared with us, I have no suggestions. Sorry.
     
  3. Yusuf-AKDAG

    Yusuf-AKDAG

    Joined:
    May 13, 2009
    Posts:
    280
    Can you check is your CenterOfMass object is near to right side of car?
     
  4. QuietPixel

    QuietPixel

    Joined:
    Jul 29, 2010
    Posts:
    51
    Are you using WheelColliders and moving the vehicle forward by applying torque to the wheels using the motorTorque variable? If so, there are known problems with that method.

    I had the same problem. A four wheeled vehicle. All wheels perfectly symmetrical left to right. All four wheels getting exactly the same motorTorque applied. Vehicle running across a perfectly flat plane, and yet it would pull to the right.

    I found the problem could be lessened by tweaking your PhysX integration time step and slip factors (see the "A car veers. Physics Issue?" thread). But ultimately, I gave up on using WheelCollider.motorTorque, and instead calculate and apply my own linear force on the vehicle's rigidbody to move it forward/backward, and apply my own torque to the body to steer it.

    I notice that in Unity's car demo, they do not use motorTorque either, instead calculating their own linear and rotational forces. Which suggests that their demo team knows that motorTorque is broken.
     
  5. jkreijkamp

    jkreijkamp

    Joined:
    Dec 5, 2007
    Posts:
    129
    It has been a while since I used wheelcolliders but I believe it has to do with the order you setup the things (or at least that was the case in the olden days).

    You have to create all the wheel colliders first before you setup the weight, radius and springs.

    Don't know if the link on http://ctrl-j.com.au/ (JCar Demo) still works, but there you can find my ancient wheel collider demo with code (it's old, my first attempt of using Unity) and see how I setup the colliders. If the download link doesn't work, let me know and I'll dig through my archives :)
     
  6. iceshaft07

    iceshaft07

    Joined:
    Jul 23, 2010
    Posts:
    293
    Mine too, but it will cost $1000 to fix it. They say my Ford Probe has a broken spring in it. (Sorry couldn't help it! :D )
     
    Helox likes this.
  7. JamesL98

    JamesL98

    Joined:
    Oct 9, 2014
    Posts:
    50
    Hey! I know this is an old thread but if anyone is stumbling around looking for an answer:
    Assuming you're using +2 wheels (the issue seems to only appear on 2+ wheels) Change the order of when you apply the forces to the wheels. For example I have an AWD car so I apply the forces to the front left first, back right second, front right third and finally the back left. Got the idea from how AUDI actually manages their quattro system so maybe its a genuine real world physics problem too and not a bug ¯\_(ツ)_/¯.

    Anyway hope that helps anyone wandering through.
     
  8. naklow12

    naklow12

    Joined:
    Jun 14, 2017
    Posts:
    8
    Hello it makes sense but how you change the order? They all work on same Update() and at the same time.
     
  9. naklow12

    naklow12

    Joined:
    Jun 14, 2017
    Posts:
    8
    I changed my mind and got rid of wheel colliders. I created my own collider system :D
     
  10. Vaskrol_W

    Vaskrol_W

    Joined:
    Feb 7, 2020
    Posts:
    1
    Omg man you helped me a lot! Thanks! I have no idea how it works and why but it fixed the issue for me.