Search Unity

Tweaking the RaceDemo car script

Discussion in 'Scripting' started by manuelflara, Mar 25, 2007.

  1. manuelflara

    manuelflara

    Joined:
    Jan 21, 2007
    Posts:
    87
    I've been tweaking the Car.js and Wheel.js script settings (not the code) but I've screwed it up. What happens is I'm lost very quickly with all that game physics jargon. What's the differential ratio? The Motor rpm range limits the top speed? Suspensing spring? And there's more. The thing is, now I have pretty much the behavior I want (a buggy or kart-like control) but it's so unstable (if I start steering and steering to the same direction, it eventually takes off and starts spinning around itself in the air. Pretty crazy).

    I attach the settings I have for the car, but what I'd like is a URL where I could read something about car physics that would help be a) tweak effectively that script or even better b) build my own. What did OTEE use to build that demo? Are they that smart or did you do your homework on car physics before coding that demo?

    Thanks!
     

    Attached Files:

  2. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    Hi Manuel
    Im pretty sure the wheel script goes on the graphical wheel, not the collider?

    In the race demo, under Create, theres a "Car Wizard" To import the lot into your project, you need the car wizard(inside the editor folder) and the two scripts you already have.

    Do you follow?

    I have a small personal nightmare similar to yours. My car goes 10x faster backwards and flips for no reason going forward. So I know what you are facing. I have to rebuild my car 100% symetrical and I should be over my night terrors.
    HTH
    AC
     
  3. manuelflara

    manuelflara

    Joined:
    Jan 21, 2007
    Posts:
    87
    Sure I know what you're talking about. I already used the Car wizard to build my car, that's not the problem. But thanks for the help anyways :)
     
  4. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    Did you consider my point about not having the wheel script on the collider-have it on the wheel model instead?

    _just tryin to get you rollin'
    AC
     
  5. manuelflara

    manuelflara

    Joined:
    Jan 21, 2007
    Posts:
    87
    Well, in the RaceDemo (which I mimic) the Wheel.js script is attached to the Collider, and then the script has a reference to the graphical wheel. Seems unlogical to attach that script to the graphical wheel seems the script already has a reference to it.
     
  6. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    Sorry man, i was working from memory, and clearly got it wrong. Sorry abot that :oops:
    AC
     
  7. forestjohnson

    forestjohnson

    Joined:
    Oct 1, 2005
    Posts:
    1,370
    I created my own car and wheel scripts that don't depend on the wheel collider and I think are at least easier to use.

    http://yogware.bluegillstudios.com/site/webplayers/car/car.html

    I think I have the project folder hosted here:

    http://yogware.bluegillstudios.com/Files/car.zip

    Feel free to download and look at it. I created that because I wanted to see how hard it would be to make a car with actual cool suspension after hearing someone talk about struggling with the wheel colliders on the irc.
     
  8. manuelflara

    manuelflara

    Joined:
    Jan 21, 2007
    Posts:
    87
    Hey, Yoggy, that control for the car you came with looks more like what I wanted. I'll take a look at your project. Thanks!
     
  9. VeganApps

    VeganApps

    Joined:
    Jun 30, 2006
    Posts:
    263