From 8dc15aac3861754a36a096b9b7bae2a2432eaea8 Mon Sep 17 00:00:00 2001 From: Mikael Hermansson Date: Wed, 5 Oct 2022 17:17:37 +0200 Subject: [PATCH] Bind PhysicsDirectBodyState3D::get_inverse_inertia_tensor --- doc/classes/PhysicsDirectBodyState3D.xml | 3 +++ doc/classes/PhysicsDirectBodyState3DExtension.xml | 5 +++++ servers/extensions/physics_server_3d_extension.cpp | 1 + servers/physics_server_3d.cpp | 2 ++ 4 files changed, 11 insertions(+) diff --git a/doc/classes/PhysicsDirectBodyState3D.xml b/doc/classes/PhysicsDirectBodyState3D.xml index efe63e4093f..04087cbfb64 100644 --- a/doc/classes/PhysicsDirectBodyState3D.xml +++ b/doc/classes/PhysicsDirectBodyState3D.xml @@ -226,6 +226,9 @@ The inverse of the inertia of the body. + + The inverse of the inertia tensor of the body. + The inverse of the mass of the body. diff --git a/doc/classes/PhysicsDirectBodyState3DExtension.xml b/doc/classes/PhysicsDirectBodyState3DExtension.xml index ade197eadc5..4432f89b9dc 100644 --- a/doc/classes/PhysicsDirectBodyState3DExtension.xml +++ b/doc/classes/PhysicsDirectBodyState3DExtension.xml @@ -159,6 +159,11 @@ + + + + + diff --git a/servers/extensions/physics_server_3d_extension.cpp b/servers/extensions/physics_server_3d_extension.cpp index 27f9ed2cb30..811ff231fcc 100644 --- a/servers/extensions/physics_server_3d_extension.cpp +++ b/servers/extensions/physics_server_3d_extension.cpp @@ -60,6 +60,7 @@ void PhysicsDirectBodyState3DExtension::_bind_methods() { GDVIRTUAL_BIND(_get_inverse_mass); GDVIRTUAL_BIND(_get_inverse_inertia); + GDVIRTUAL_BIND(_get_inverse_inertia_tensor); GDVIRTUAL_BIND(_set_linear_velocity, "velocity"); GDVIRTUAL_BIND(_get_linear_velocity); diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp index 24cc7e8459a..db21e1db063 100644 --- a/servers/physics_server_3d.cpp +++ b/servers/physics_server_3d.cpp @@ -99,6 +99,7 @@ void PhysicsDirectBodyState3D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_inverse_mass"), &PhysicsDirectBodyState3D::get_inverse_mass); ClassDB::bind_method(D_METHOD("get_inverse_inertia"), &PhysicsDirectBodyState3D::get_inverse_inertia); + ClassDB::bind_method(D_METHOD("get_inverse_inertia_tensor"), &PhysicsDirectBodyState3D::get_inverse_inertia_tensor); ClassDB::bind_method(D_METHOD("set_linear_velocity", "velocity"), &PhysicsDirectBodyState3D::set_linear_velocity); ClassDB::bind_method(D_METHOD("get_linear_velocity"), &PhysicsDirectBodyState3D::get_linear_velocity); @@ -153,6 +154,7 @@ void PhysicsDirectBodyState3D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "total_angular_damp"), "", "get_total_angular_damp"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "total_linear_damp"), "", "get_total_linear_damp"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "inverse_inertia"), "", "get_inverse_inertia"); + ADD_PROPERTY(PropertyInfo(Variant::BASIS, "inverse_inertia_tensor"), "", "get_inverse_inertia_tensor"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "total_gravity"), "", "get_total_gravity"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "center_of_mass"), "", "get_center_of_mass"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "center_of_mass_local"), "", "get_center_of_mass_local");