Vehicle using 6dof Joints

Godot Version

4.7

Question

First: i do not want to use vehicleBody, i need help trying to figure out my problem with 6dofJoint.

The problem: This is my current vehicle configuration, i made it using a rigidBody for the chassis and 4 generic6dofJoints for each wheel suspension, the vehicle suspension works great much better than i expected the only problem is vehicle speed is limited to 22 linear velocity.

I tried increasing the torque force on the wheels but the car only acelerate faster reaching the 22 speed limit and no more even on down hills the car doesnot speed up, i tried everything if someone have some info i apreciate.

i am applying torque on the wheels rigidbody that is conected to the suspension (generic6dofjoint), the wheels has traction and the suspensions works.

Its like the car always on first gear.

here is the code of the car_rb (chassi rigidbody):slight_smile:
extends RigidBody3D

@exportexport var wheel_fl_rb: RigidB@exportdy3D
@export var wheel_fr_rb: @exportigidBody3D
@export var wheel_r@export_rb: RigidBody3D
@export var w@exporteel_rr_rb: RigidBody3D
@export var tr@exportction_power: float = 50000.0
@export v@exportr susp_fr_6dof: Generic6DOFJoint3D
@export var susp_fl_6dof: Generic6DOFJoint3D

var max_angle: float = deg_to_rad(30.0)
var speed: float = 0.0
@export var speed_ui: RichTextLabel

func _physics_process(delta: float) → void:
var acc = Input.get_axis(“ui_down”, “ui_up”)
var dir = Input.get_axis(“ui_left”, “ui_right”) * max_angle

# torque on wheels
wheel_rl_rb.apply_torque(wheel_rl_rb.global_transform.basis.x * acc * traction_power)
wheel_rr_rb.apply_torque(wheel_rr_rb.global_transform.basis.x * acc * traction_power)
wheel_fl_rb.apply_torque(wheel_fl_rb.global_transform.basis.x * acc * traction_power * 0.5)
wheel_fr_rb.apply_torque(wheel_fr_rb.global_transform.basis.x * acc * traction_power * 0.5)

# car speed
speed = linear_velocity.length()

# setting 6dof joint angle limit for steering
susp_fl_6dof.set_param_y(Generic6DOFJoint3D.PARAM_ANGULAR_LOWER_LIMIT, dir)
susp_fl_6dof.set_param_y(Generic6DOFJoint3D.PARAM_ANGULAR_UPPER_LIMIT, dir)
susp_fr_6dof.set_param_y(Generic6DOFJoint3D.PARAM_ANGULAR_LOWER_LIMIT, dir)
susp_fr_6dof.set_param_y(Generic6DOFJoint3D.PARAM_ANGULAR_UPPER_LIMIT, dir)

# ui
speed_ui.text = "speed: " + str(speed).pad_decimals(1)

Godot Version

4.7

Question

First: i do not want to use vehicleBody, i need help trying to figure out my problem with 6dofJoint.

The problem: This is my current vehicle configuration, i made it using a rigidBody for the chassis and 4 generic6dofJoints for each wheel suspension, the vehicle suspension works great much better than i expected the only problem is vehicle speed is limited to 22 linear velocity.

I tried increasing the torque force on the wheels but the car only acelerate faster reaching the 22 speed limit and no more even on down hills the car doesnot speed up, i tried everything if someone have some info i apreciate.

i am applying torque on the wheels rigidbody that is conected to the suspension (generic6dofjoint), the wheels has traction and the suspensions works.

Its like the car always on first gear.

here is the code of the car_rb (chassi rigidbody):slight_smile:
extends RigidBody3D

@exportexportexportexportexportexportexportexport var wheel_fl_rb: @exportigidB@exportexportdy3D
@export@exportigi@exportigidBody3DB@exdy3Dv@exportr wheel_fr_rb: @exportigidBody3D
@ex@exp@exportrtort var wheel_r@export_rb: RigidBody@exp@exportrtD
@export var w@exporteel_rr_rb: RigidBody3@exp@exportrt
@export var tr@exportction_power: float =@export5@export000.0
@export v@exportr susp_fr_6dof: Generic6DOFJoint3D
@export var susp_fl_6dof: Generic6DOF@exportoint3D

var max_angle: float = deg_to_rad(30.0)
var speed: float = 0.0
@export var speed_ui: RichTextLabel

func _physics_process(delta: float) → void:
var acc = Input.get_axis(“ui_down”, “ui_up”)
var dir = Input.get_axis(“ui_left”, “ui_right”) * max_angle

# torque on wheels
wheel_rl_rb.apply_torque(wheel_rl_rb.global_transform.basis.x * acc * traction_power)
wheel_rr_rb.apply_torque(wheel_rr_rb.global_transform.basis.x * acc * traction_power)
wheel_fl_rb.apply_torque(wheel_fl_rb.global_transform.basis.x * acc * traction_power * 0.5)
wheel_fr_rb.apply_torque(wheel_fr_rb.global_transform.basis.x * acc * traction_power * 0.5)

# car speed
speed = linear_velocity.length()

# setting 6dof joint angle limit for steering
susp_fl_6dof.set_param_y(Generic6DOFJoint3D.PARAM_ANGULAR_LOWER_LIMIT, dir)
susp_fl_6dof.set_param_y(Generic6DOFJoint3D.PARAM_ANGULAR_UPPER_LIMIT, dir)
susp_fr_6dof.set_param_y(Generic6DOFJoint3D.PARAM_ANGULAR_LOWER_LIMIT, dir)
susp_fr_6dof.set_param_y(Generic6DOFJoint3D.PARAM_ANGULAR_UPPER_LIMIT, dir)

# ui
speed_ui.text = "speed: " + str(speed).pad_decimals(1)

I found a solution so this topic can be closed.