Skip to main content

wheel3d

3d · physics · 11 properties · 3D

One wheel of the vehicle3d above it. Where the node sits on the chassis is where the wheel's ray starts; the rest is suspension tuning. Drive it with physics3d.set_engine_force, set_brake and set_steering.

In a scene, wheel3d is the node key that applies it. A script reaches the same properties through node.wheel3d.get() and node.wheel3d.set(table).

Properties

propertytypedefaultdescription
axlevec3[-1,0,0]The axle the wheel turns about, in the chassis's own space
compressionfloat0.82Damping while the suspension is being squashed At least 0.
dampingfloat0.88Damping while the suspension is coming back At least 0.
directionvec3[0,-1,0]Which way the suspension pushes, in the chassis's own space: down
friction_slipfloat10.5Grip along the wheel's rolling direction; lower slides more At least 0.
max_forcefloat6000The most force this suspension may push the chassis with At least 0.
max_travelfloat5How far the suspension may move in total At least 0.
radiusfloat0.4The wheel's radius, which is how far off the ground it holds the ray's end At least 0.01.
rest_lengthfloat0.3How long the suspension is with no weight on it At least 0.
side_frictionfloat1Grip sideways: what stops the car sliding out of a corner At least 0.
stiffnessfloat30Spring stiffness: higher is a stiffer, twitchier car At least 0.

Script functions

Methods of node.wheel3d, the handle a node carrying this component exposes. Each is also a free function on its module, taking the node as its first argument. Every handle also has get(), set(table), has() and remove().

From physics3d:

methodwhat it does
set_brake(float)How hard this wheel brakes.
set_engine_force(float)How hard this wheel drives, in newtons; negative reverses.
set_steering(float)Turn this wheel, in radians.
wheel_state() -> anyWhat the last step did with this wheel: #{ rotation, suspension_force, grounded, engine_force, brake, steering }.