summaryrefslogtreecommitdiff
path: root/servers/physics_3d/body_3d_sw.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-09-17 19:38:36 +0200
committerGitHub <noreply@github.com>2021-09-17 19:38:36 +0200
commit220b69ab564566ca00c8263b629e3d3d3cc64eb5 (patch)
treee14f4e0c715294ecac8162d88ccde4e06671faad /servers/physics_3d/body_3d_sw.cpp
parent7762e8b1c1fbabc69769e8df9d6aa2443d309892 (diff)
parentbf0213470cbfa63bbcce9f614f2cc2ecaae5fe54 (diff)
Merge pull request #52450 from aaronfranke/they-came-from-scale
Replace Vector3.to_diagonal_matrix with Basis.from_scale
Diffstat (limited to 'servers/physics_3d/body_3d_sw.cpp')
-rw-r--r--servers/physics_3d/body_3d_sw.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/servers/physics_3d/body_3d_sw.cpp b/servers/physics_3d/body_3d_sw.cpp
index 41745545d8..5924e249a5 100644
--- a/servers/physics_3d/body_3d_sw.cpp
+++ b/servers/physics_3d/body_3d_sw.cpp
@@ -110,7 +110,7 @@ void Body3DSW::update_mass_properties() {
real_t mass = area * this->mass / total_area;
- Basis shape_inertia_tensor = shape->get_moment_of_inertia(mass).to_diagonal_matrix();
+ Basis shape_inertia_tensor = Basis::from_scale(shape->get_moment_of_inertia(mass));
Transform3D shape_transform = get_shape_transform(i);
Basis shape_basis = shape_transform.basis.orthonormalized();
@@ -123,7 +123,7 @@ void Body3DSW::update_mass_properties() {
// Set the inertia to a valid value when there are no valid shapes.
if (!inertia_set) {
- inertia_tensor.set_diagonal(Vector3(1.0, 1.0, 1.0));
+ inertia_tensor = Basis();
}
// Handle partial custom inertia.
@@ -215,7 +215,7 @@ void Body3DSW::set_param(PhysicsServer3D::BodyParameter p_param, const Variant &
} else {
calculate_inertia = false;
if (mode == PhysicsServer3D::BODY_MODE_DYNAMIC) {
- principal_inertia_axes_local.set_diagonal(Vector3(1.0, 1.0, 1.0));
+ principal_inertia_axes_local = Basis();
_inv_inertia = inertia.inverse();
_update_transform_dependant();
}
@@ -301,7 +301,7 @@ void Body3DSW::set_mode(PhysicsServer3D::BodyMode p_mode) {
case PhysicsServer3D::BODY_MODE_DYNAMIC: {
_inv_mass = mass > 0 ? (1.0 / mass) : 0;
if (!calculate_inertia) {
- principal_inertia_axes_local.set_diagonal(Vector3(1.0, 1.0, 1.0));
+ principal_inertia_axes_local = Basis();
_inv_inertia = inertia.inverse();
_update_transform_dependant();
}