Search Unity

Basic Car Physics

Discussion in 'Scripting' started by CalaveraX, Sep 30, 2014.

  1. CalaveraX

    CalaveraX

    Joined:
    Jul 11, 2013
    Posts:
    143
  2. ZO5KmUG6R

    ZO5KmUG6R

    Joined:
    Jul 15, 2010
    Posts:
    490
    Play around with the damping and spring, more damping = less stiffness.
     
  3. CalaveraX

    CalaveraX

    Joined:
    Jul 11, 2013
    Posts:
    143
    But how do i make the Car?

    This is how i have it
    I have an Empty Game Object (With the rigid body) that contains the car Body,
    As children of the body i have two grops, one with the 4 wheels, and another with 4 wheels colliders (At the positions of the wheels)


    How should i do to make the car move? Using the 4 wheelsColliders.addmotortorque ?

    I'l check the suspension damping now :)

    Thanks!
     
  4. ZO5KmUG6R

    ZO5KmUG6R

    Joined:
    Jul 15, 2010
    Posts:
    490
    Last edited: Sep 30, 2014
  5. CalaveraX

    CalaveraX

    Joined:
    Jul 11, 2013
    Posts:
    143
    Amazing! Thanks!! :)
     
  6. CalaveraX

    CalaveraX

    Joined:
    Jul 11, 2013
    Posts:
    143
    I'm trying to make a car from scratch, and the last video it shows how to make it with some scripts that are from 2011 :(

    Any idea how do i say the connected rigid body to my wheels? and to wich wheels do i have to apply torque?
     
  7. ZO5KmUG6R

    ZO5KmUG6R

    Joined:
    Jul 15, 2010
    Posts:
    490
    WheelColliders havent changed in years, and the basic principles still apply. You just have to parent your wheels to the body in the hierarchy view.
     
  8. CalaveraX

    CalaveraX

    Joined:
    Jul 11, 2013
    Posts:
    143
    do i have to add some SpringJoint between the wheels and the car body so the car have a suspension? i'm playing with the wheel joint suspension and damping and i dont get the wheel to be less "static"

    i managed to get the car with the wheels rotating arround, and adding torque to the colliders for the car move, but its still like a car made of legos :p
     
  9. CalaveraX

    CalaveraX

    Joined:
    Jul 11, 2013
    Posts:
    143
    Found a really simple way to do this :)