Skip to content
6 changes: 6 additions & 0 deletions doc/classes/VehicleWheel3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
Returns the normal of the suspension's collision in world space if the wheel is in contact. If the wheel isn't in contact with anything, returns a vector pointing directly along the suspension axis toward the vehicle in world space.
</description>
</method>
<method name="get_contact_normal_force" qualifiers="const">
<return type="float" />
<description>
Returns the magnitude of the normal force at the wheel's contact point with the ground in Newtons (N). This represents the perpendicular force exerted by the surface on the wheel. Use [method get_contact_normal] to get the direction of this force. Returns [code]0.0[/code] if the wheel is not in contact with any surface.
</description>
</method>
<method name="get_contact_point" qualifiers="const">
<return type="Vector3" />
<description>
Expand Down
5 changes: 5 additions & 0 deletions scene/3d/physics/vehicle_body_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ Node3D *VehicleWheel3D::get_contact_body() const {
return m_raycastInfo.m_groundObject;
}

real_t VehicleWheel3D::get_contact_normal_force() const {
return m_wheelsSuspensionForce;
}

void VehicleWheel3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_radius", "length"), &VehicleWheel3D::set_radius);
ClassDB::bind_method(D_METHOD("get_radius"), &VehicleWheel3D::get_radius);
Expand Down Expand Up @@ -302,6 +306,7 @@ void VehicleWheel3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_contact_body"), &VehicleWheel3D::get_contact_body);
ClassDB::bind_method(D_METHOD("get_contact_point"), &VehicleWheel3D::get_contact_point);
ClassDB::bind_method(D_METHOD("get_contact_normal"), &VehicleWheel3D::get_contact_normal);
ClassDB::bind_method(D_METHOD("get_contact_normal_force"), &VehicleWheel3D::get_contact_normal_force);

ClassDB::bind_method(D_METHOD("set_roll_influence", "roll_influence"), &VehicleWheel3D::set_roll_influence);
ClassDB::bind_method(D_METHOD("get_roll_influence"), &VehicleWheel3D::get_roll_influence);
Expand Down
2 changes: 2 additions & 0 deletions scene/3d/physics/vehicle_body_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ class VehicleWheel3D : public Node3D {

real_t get_skidinfo() const;

real_t get_contact_normal_force() const;

real_t get_rpm() const;

void set_engine_force(real_t p_engine_force);
Expand Down