VehicleWheel

Inherits: Spatial < Node < Object

Objeto físico que simula el comportamiento de una rueda.

Descripción

This node needs to be used as a child node of VehicleBody 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.

Tutoriales

Propiedades

float

brake

0.0

float

damping_compression

0.83

float

damping_relaxation

0.88

float

engine_force

0.0

float

steering

0.0

float

suspension_max_force

6000.0

float

suspension_stiffness

5.88

float

suspension_travel

5.0

bool

use_as_steering

false

bool

use_as_traction

false

float

wheel_friction_slip

10.5

float

wheel_radius

0.5

float

wheel_rest_length

0.15

float

wheel_roll_influence

0.1

Métodos

Spatial

get_contact_body ( ) const

float

get_rpm ( ) const

float

get_skidinfo ( ) const

bool

is_in_contact ( ) const

Descripciones de Propiedades

Default

0.0

Setter

set_brake(value)

Getter

get_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.


  • float damping_compression

Default

0.83

Setter

set_damping_compression(value)

Getter

get_damping_compression()

La amortiguación aplicada al resorte cuando éste se está comprimiendo. Este valor debe estar entre 0.0 (sin amortiguación) y 1.0. Un valor de 0.0 significa que el coche seguirá rebotando mientras el muelle mantiene su energía. Un buen valor para esto es alrededor de 0.3 para un coche normal, 0.5 para un coche de carreras.


  • float damping_relaxation

Default

0.88

Setter

set_damping_relaxation(value)

Getter

get_damping_relaxation()

La amortiguación aplicada al resorte al relajarse. Este valor debe estar entre 0.0 (sin amortiguación) y 1.0. Este valor siempre debe ser ligeramente superior a la propiedad damping_compression. Para un valor de damping_compression de 0,3, pruebe un valor de relajación de 0,5.


Default

0.0

Setter

set_engine_force(value)

Getter

get_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.

Note: The simulation does not take the effect of gears into account, you will need to add logic for this if you wish to simulate gears.

A negative value will result in the wheel reversing.


Default

0.0

Setter

set_steering(value)

Getter

get_steering()

El ángulo de dirección del volante. Si lo fijamos en un valor distinto de cero, el vehículo girará cuando esté en movimiento.


  • float suspension_max_force

Default

6000.0

Setter

set_suspension_max_force(value)

Getter

get_suspension_max_force()

The maximum force the spring can resist. This value should be higher than a quarter of the RigidBody.mass 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.


  • float suspension_stiffness

Default

5.88

Setter

set_suspension_stiffness(value)

Getter

get_suspension_stiffness()

Este valor define la rigidez de la suspensión. Usa un valor inferior a 50 para un coche todoterreno, un valor entre 50 y 100 para un coche de carreras y prueba algo alrededor de 200 para algo como un coche de Fórmula 1.


  • float suspension_travel

Default

5.0

Setter

set_suspension_travel(value)

Getter

get_suspension_travel()

Esta es la distancia que puede recorrer la suspensión. Como las unidades Godot equivalen a metros, mantenga este ajuste relativamente bajo. Pruebe con un valor entre 0,1 y 0,3 dependiendo del tipo de coche.


  • bool use_as_steering

Default

false

Setter

set_use_as_steering(value)

Getter

is_used_as_steering()

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


  • bool use_as_traction

Default

false

Setter

set_use_as_traction(value)

Getter

is_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 engine_force value instead.


  • float wheel_friction_slip

Default

10.5

Setter

set_friction_slip(value)

Getter

get_friction_slip()

Esto determina cuánto agarre tiene esta rueda. Se combina con el ajuste de la fricción de la superficie con la que la rueda está en contacto. 0.0 significa que no hay agarre, 1.0 es el agarre normal. Para una configuración de coche a la deriva, intente ajustar el agarre de las ruedas traseras ligeramente más bajo que el de las ruedas delanteras, o utilice un valor más bajo para simular el desgaste de los neumáticos.

Lo mejor es ajustarlo a 1.0 al comenzar.


Default

0.5

Setter

set_radius(value)

Getter

get_radius()

El radio de la rueda en metros.


  • float wheel_rest_length

Default

0.15

Setter

set_suspension_rest_length(value)

Getter

get_suspension_rest_length()

Esta es la distancia en metros a la que se baja la rueda desde su punto de origen. No lo pongas a 0.0 y mueve la rueda a su posición, en su lugar mueve el punto de origen de tu rueda (el gizmo en Godot) a la posición que la rueda tomará al descender, luego usa la longitud de reposo para mover la rueda hacia abajo a la posición en la que debería estar cuando el auto esté en reposo.


  • float wheel_roll_influence

Default

0.1

Setter

set_roll_influence(value)

Getter

get_roll_influence()

Este valor afecta al balanceo de su vehículo. Si se establece en 1,0 para todas las ruedas, tu vehículo será propenso a volcarse, mientras que un valor de 0.0 resistirá el balanceo de la carrocería.

Descripciones de Métodos

  • Spatial get_contact_body ( ) const

Returns the contacting body node if valid in the tree, as Spatial. At the moment, GridMap is not supported so the node will be always of type PhysicsBody.

Returns null if the wheel is not in contact with a surface, or the contact body is not a PhysicsBody.


  • float get_rpm ( ) const

Devuelve la velocidad de rotación de la rueda en revoluciones por minuto.


  • float get_skidinfo ( ) const

Devuelve un valor entre 0.0 y 1.0 que indica si esta rueda está patinando. 0.0 es patinar (la rueda ha perdido el agarre, por ejemplo, en un terreno helado), 1.0 significa no patinar (la rueda tiene un agarre total, por ejemplo, en una carretera de asfalto seco).


  • bool is_in_contact ( ) const

Devuelve true si esta rueda está en contacto con una superficie.