VehicleWheel

    Physics object that simulates the behavior of a wheel.

    This node needs to be used as a child node of and simulates the behavior of one of its wheels. This node also acts as a collider to detect if the wheel is touching a surface.

    Note: This class has known issues and isn’t designed to provide realistic 3D vehicle physics. If you want advanced vehicle physics, you will probably have to write your own physics integration using another PhysicsBody class.

    Tutorials

    Methods

    float ( ) const
    float ( ) const
    bool ( ) const
    Default0.0
    Setterset_brake(value)
    Getterget_brake()

    Slows down the wheel by applying a braking force. The wheel is only slowed down if it is in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the RigidBody.mass of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 30 range for hard braking.


    • damping_compression
    Default0.83
    Setterset_damping_compression(value)
    Getterget_damping_compression()

    The damping applied to the spring when the spring is being compressed. This value should be between 0.0 (no damping) and 1.0. A value of 0.0 means the car will keep bouncing as the spring keeps its energy. A good value for this is around 0.3 for a normal car, 0.5 for a race car.


    • float damping_relaxation
    Default0.88
    Setterset_damping_relaxation(value)
    Getterget_damping_relaxation()

    The damping applied to the spring when relaxing. This value should be between 0.0 (no damping) and 1.0. This value should always be slightly higher than the property. For a damping_compression value of 0.3, try a relaxation value of 0.5.


    • engine_force

    Accelerates the wheel by applying an engine force. The wheel is only speed up if it is in contact with a surface. The RigidBody.mass of the vehicle has an effect on the acceleration of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 50 range for acceleration.

    A negative value will result in the wheel reversing.


    • steering
    Default0.0
    Setterset_steering(value)
    Getterget_steering()

    The steering angle for the wheel. Setting this to a non-zero value will result in the vehicle turning when it’s moving.


    • float suspension_max_force
    Default6000.0
    Setterset_suspension_max_force(value)
    Getterget_suspension_max_force()

    The maximum force the spring can resist. This value should be higher than a quarter of the of the VehicleBody or the spring will not carry the weight of the vehicle. Good results are often obtained by a value that is about 3× to 4× this number.


    • suspension_stiffness
    Default
    Setterset_suspension_stiffness(value)
    Getterget_suspension_stiffness()

    This value defines the stiffness of the suspension. Use a value lower than 50 for an off-road car, a value between 50 and 100 for a race car and try something around 200 for something like a Formula 1 car.


    Default5.0
    Setterset_suspension_travel(value)
    Getterget_suspension_travel()

    This is the distance the suspension can travel. As Godot units are equivalent to meters, keep this setting relatively low. Try a value between 0.1 and 0.3 depending on the type of car.


    If true, this wheel will be turned when the car steers. This value is used in conjunction with and ignored if you are using the per-wheel steering value instead.


    • use_as_traction
    Defaultfalse
    Setterset_use_as_traction(value)
    Getteris_used_as_traction()

    If true, this wheel transfers engine force to the ground to propel the vehicle forward. This value is used in conjunction with VehicleBody.engine_force and ignored if you are using the per-wheel value instead.


    • float wheel_friction_slip
    Default10.5
    Setterset_friction_slip(value)
    Getterget_friction_slip()

    It’s best to set this to 1.0 when starting out.


    • wheel_radius
    Default0.5
    Setterset_radius(value)
    Getterget_radius()

    The radius of the wheel in meters.


    Default0.15
    Setterset_suspension_rest_length(value)
    Getterget_suspension_rest_length()

    This is the distance in meters the wheel is lowered from its origin point. Don’t set this to 0.0 and move the wheel into position, instead move the origin point of your wheel (the gizmo in Godot) to the position the wheel will take when bottoming out, then use the rest length to move the wheel down to the position it should be in when the car is in rest.


    • wheel_roll_influence

    This value affects the roll of your vehicle. If set to 1.0 for all wheels, your vehicle will be prone to rolling over, while a value of 0.0 will resist body roll.

    Method Descriptions

    Returns the rotational speed of the wheel in revolutions per minute.


    • get_skidinfo ( ) const

    Returns a value between 0.0 and 1.0 that indicates whether this wheel is skidding. 0.0 is skidding (the wheel has lost grip, e.g. icy terrain), 1.0 means not skidding (the wheel has full grip, e.g. dry asphalt road).


    Returns if this wheel is in contact with a surface.