VehicleBody

Physics body that simulates the behavior of a car.

This node implements all the physics logic needed to simulate a car. It is based on the raycast vehicle system commonly found in physics engines. You will need to add a CollisionShape for the main body of your vehicle and add VehicleWheel nodes for the wheels. You should also add a MeshInstance to this node for the 3D model of your car but this model should not include meshes for the wheels. You should control the vehicle by using the brake, engineForce, and steering properties and not change the position or orientation of this node directly. Note: The origin point of your VehicleBody will determine the center of gravity of your vehicle so it is better to keep this low and move the CollisionShape and MeshInstance upwards. 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.

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

getBrake
double getBrake()
getEngineForce
double getEngineForce()
getSteering
double getSteering()
opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(VehicleBody other)
opEquals
bool opEquals(typeof(null) n)
setBrake
void setBrake(double brake)
setEngineForce
void setEngineForce(double engine_force)
setSteering
void setSteering(double steering)
toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

brake
double brake [@property getter]
double brake [@property setter]

Slows down the vehicle by applying a braking force. The vehicle is only slowed down if the wheels are 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.

engineForce
double engineForce [@property getter]
double engineForce [@property setter]

Accelerates the vehicle by applying an engine force. The vehicle is only speed up if the wheels that have VehicleWheel.useAsTraction set to true and are 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 vehicle reversing.

steering
double steering [@property getter]
double steering [@property setter]

The steering angle for the vehicle. Setting this to a non-zero value will result in the vehicle turning when it's moving. Wheels that have VehicleWheel.useAsSteering set to true will automatically be rotated.

Static functions

_new
VehicleBody _new()

Construct a new instance of VehicleBody. Note: use memnew!VehicleBody instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta