Progetto H — API Reference API & Scripting Documentation
Function Server Moderate

VehicleWheeled:SetWheel

Wheels can be updated in runtime by calling SetWheel again, you can for example change the suspension high or disable a wheel totally by toggling affected_by_engine off or setting radius to 0.

Syntax

Lua
my_vehicle_wheeled:SetWheel(index, bone_name, radius = 32, width = 20, max_steer_angle = 50, offset = Vector(0, 0, 0), is_affected_by_engine = true, is_affected_by_brake = true, is_affected_by_handbrake = true, has_abs_enabled = false, has_traction_control_enabled = false, max_brake_torque = 1500, max_handbrake_torque = 3000, cornering_stiffness = 1000, side_slip_modifier = 1.0, friction_force_multiplier = 2.0, slip_threshold = 20.0, skid_threshold = 20.0, suspension_spring_rate = 250.0, suspension_spring_preload = 50.0, suspension_max_raise = 10.0, suspension_max_drop = 10.0, suspension_smoothing = 0.0, suspension_damping_ratio = 0.5, suspension_wheel_load_ratio = 0.5, suspension_axis = Vector(0, 0, -1), suspension_force_offset = Vector(0, 0, 0), suspension_sweep_shape = SuspensionSweepShape.Raycast)

Parameters

Name Type Default Description
index integer Index of the wheel (0-N). Set it in ASC order
bone_name string Name of the bone to attach this wheel to
radius optional integer 32 Radius of the wheel
width optional integer 20 Width of the wheel
max_steer_angle optional integer 50 Steer angle in degrees for this wheel
offset optional Vector Vector(0, 0, 0) If bone_name is specified, offset the wheel from the bone's location. Otherwise this offsets the wheel from the vehicle's origin
is_affected_by_engine optional boolean true Whether engine should power this wheel
is_affected_by_brake optional boolean true Whether brake should affect this wheel
is_affected_by_handbrake optional boolean true Whether handbrake should affect this wheel
has_abs_enabled optional boolean false Advanced Braking System Enabled
has_traction_control_enabled optional boolean false Straight Line Traction Control Enabled
max_brake_torque optional integer 1500 Max brake torque for this wheel (Nm)
max_handbrake_torque optional integer 3000 Max handbrake brake torque for this wheel (Nm). A handbrake should have a stronger brake torque than the brake
cornering_stiffness optional integer 1000 Tyre Cornering Ability
side_slip_modifier optional float 1.0 Wheel Lateral Skid Grip Loss, lower number less grip on skid
friction_force_multiplier optional float 2.0 Friction Force Multiplier
slip_threshold optional float 20.0 Wheel Longitudinal Slip Threshold
skid_threshold optional float 20.0 Wheel Lateral Skid Threshold
suspension_spring_rate optional float 250.0 Spring Force (N/m)
suspension_spring_preload optional float 50.0 Spring Preload (N/m)
suspension_max_raise optional float 10.0 How far the wheel can go above the resting position
suspension_max_drop optional float 10.0 How far the wheel can drop below the resting position
suspension_smoothing optional float 0.0 Smooth suspension [0-off, 10-max] - Warning might cause momentary visual inter-penetration of the wheel against objects/terrain
suspension_damping_ratio optional float 0.5 Suspension damping, larger value causes the suspension to come to rest faster [range 0 to 1]
suspension_wheel_load_ratio optional float 0.5 Amount wheel load effects wheel friction. <br/> - At 0 wheel friction is completely independent of the loading on the wheel (This is artificial as it always assumes even balance between all wheels) <br/> - At 1 wheel friction is based on the force pressing wheel into the ground. This is more realistic. <br/> - Lower value cures lift off over-steer, generally makes vehicle easier to handle under extreme motions.
suspension_axis optional Vector Vector(0, 0, -1) Local body direction in which where suspension forces are applied (typically along -Z-axis)
suspension_force_offset optional Vector Vector(0, 0, 0) Vertical offset from where suspension forces are applied (along Z-axis)
suspension_sweep_shape optional SuspensionSweepShape SuspensionSweepShape.Raycast Wheel suspension trace type, defaults to ray trace