Skip to content

Search

Documentation

wheel3d component

One wheel of the vehicle3d above it; the node's position on the chassis is where its ray starts. physics3d.set_engine_force, set_brake and set_steering…

Σε αυτή τη σελίδα

3d · physics · 11 properties · 3D

One wheel of the vehicle3d above it; the node's position on the chassis is where its ray starts. physics3d.set_engine_force, set_brake and set_steering drive it.

In a scene, wheel3d is the node key that applies it. A script reaches each property below as a field on node.wheel3d: reading one asks the running component, and assigning one leaves the rest alone. The whole table is node.wheel3d.get() and node.wheel3d.set(table).

Properties

property type default description
axle vec3 [-1,0,0] The axle the wheel turns about, in the chassis's own space
damping_compression float 0.82 Damping while the suspension is being squashed At least 0.
damping_relaxation float 0.88 Damping while the suspension is coming back At least 0.
friction_slip float 10.5 Grip along the wheel's rolling direction; lower slides more At least 0.
radius float 0.4 The wheel's radius, which is how far off the ground it holds the ray's end At least 0.01.
rest_length float 0.3 How long the suspension is with no weight on it At least 0.
side_friction float 1 Grip sideways: what stops the car sliding out of a corner At least 0.
suspension_direction vec3 [0,-1,0] Which way the suspension pushes, in the chassis's own space: down
suspension_max_force float 6000 The most force this suspension may push the chassis with At least 0.
suspension_stiffness float 30 Spring stiffness, scaled by the chassis's mass: higher is a stiffer, twitchier car At least 0.
suspension_travel float 5 How far the suspension may move either side of its rest length At least 0.

Script functions

Methods of node.wheel3d, the handle a node carrying this component exposes. Every handle also has get(), set(table), patch(table), has() and remove().

From physics3d:

method what it does
set_brake(float) How hard this wheel brakes, as an impulse; ignored while its engine force is not 0.
set_engine_force(float) How hard this wheel drives, in newtons; negative reverses.
set_steering(float) Turn this wheel, in radians.
set_wheel_rotation(float) Set how far the wheel has turned about its axle, in radians: the angle wheel_state reads as rotation.
wheel_state() -> any What the last step did with this wheel: #{ rotation, suspension_force, in_contact, engine_force, brake, steering, forward_impulse, side_impulse, contact_normal, contact_point, suspension_length, ray_origin, ground, center, suspension, axle }. suspension_force is what the suspension pushed with, after suspension_max_force; the two impulses are the friction rapier applied along and across the wheel; the contact, the ray's start, the wheel's centre and its suspension and axle directions are world space, after steering; ground is the node the ray hit, or nil.