Add Method get_inverse_inertia_tensor #40512
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Exposed inertia tensor to GDScript
How
This was done by creating a variable on the rigidbody class. The variable receives the inverse inertia tensor value each time the RigidBody state gets changed, then the
get_inverse_inertia_tensor()
returns the the inverse_inertia_tensor. The method is exposed to GDScript withbind_method
Consequences
As a consequence of this, rotations with rigid bodies can be controlled more accurately through the use of Physics Formulas of Torque
Requests
This was proposed in: godotengine/godot-proposals#1114 also in #2125 and kind of related to godotengine/godot-proposals#945
This Pull Request has been made in the Godot 3.2 branch at #39817 and now I've made it in the Master Branch (due to class name changes, for instance RigidBody class became RigidBody3D)