Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

wheel colliders

Discussion in 'Editor & General Support' started by llavigne, Feb 14, 2008.

  1. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
    Has anyone used the wheel collider and achieved descent results with it ?
     
  2. 64746c

    64746c

    Joined:
    Oct 21, 2007
    Posts:
    181
    Yes, it's actually fairly flexible, although not completely realistic. I used them with Off Roadin', which is on my blog.
     
  3. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
    It's the best example I have seen with the wheel collider. How did you achieve this ? And how would you make the physics feel more earth like?

    Off topic. The AI is quite good, I like how it anticipates the next curve - and it's kicking my a** - how did you achieve this waypoints ?
     
  4. 64746c

    64746c

    Joined:
    Oct 21, 2007
    Posts:
    181
    I think most of the realism comes from setting the friction values way lower. Here's the setup for the player's wheel collider (changed very slightly since last release):

    I'm kinda-sorta working on a custom Wheel class, which will simulate contact patches, weight transfer, etc, and hopefully will be a lot more realistic and customizable.

    As for the AI—yes, they use waypoints. The AI is good for two reasons, mainly: I set up the waypoints very carefully, and the AI car is actually 20% slower than the player car.
    Code (csharp):
    1. forwardsAccel = aiSpeed * speed;
    Where speed is a general modifier and aiSpeed is 0.8. This reduced speed gives them a little more grip and a little less airtime, which lets them get around a bit faster.
     
  5. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
    Thanks for sharing.