diff options
Diffstat (limited to 'servers/physics')
-rw-r--r-- | servers/physics/body_sw.cpp | 5 | ||||
-rw-r--r-- | servers/physics/joints/generic_6dof_joint_sw.cpp | 4 | ||||
-rw-r--r-- | servers/physics/physics_server_sw.cpp | 14 |
3 files changed, 5 insertions, 18 deletions
diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp index 46a5192e52..6ced004118 100644 --- a/servers/physics/body_sw.cpp +++ b/servers/physics/body_sw.cpp @@ -45,8 +45,9 @@ void BodySW::_update_transform_dependant() { // update inertia tensor Basis tb = principal_inertia_axes; Basis tbt = tb.transposed(); - tb.scale(_inv_inertia); - _inv_inertia_tensor = tb * tbt; + Basis diag; + diag.scale(_inv_inertia); + _inv_inertia_tensor = tb * diag * tbt; } void BodySW::update_inertias() { diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp index 70cc549e2d..1e323be36c 100644 --- a/servers/physics/joints/generic_6dof_joint_sw.cpp +++ b/servers/physics/joints/generic_6dof_joint_sw.cpp @@ -219,9 +219,9 @@ Generic6DOFJointSW::Generic6DOFJointSW(BodySW *rbA, BodySW *rbB, const Transform } void Generic6DOFJointSW::calculateAngleInfo() { - Basis relative_frame = m_calculatedTransformA.basis.inverse() * m_calculatedTransformB.basis; + Basis relative_frame = m_calculatedTransformB.basis.inverse() * m_calculatedTransformA.basis; - m_calculatedAxisAngleDiff = relative_frame.get_euler(); + m_calculatedAxisAngleDiff = relative_frame.get_euler_xyz(); // in euler angle mode we do not actually constrain the angular velocity // along the axes axis[0] and axis[2] (although we do use axis[1]) : diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp index a7c31cf16c..5ba935d47c 100644 --- a/servers/physics/physics_server_sw.cpp +++ b/servers/physics/physics_server_sw.cpp @@ -233,14 +233,7 @@ void PhysicsServerSW::area_set_space(RID p_area, RID p_space) { if (area->get_space() == space) return; //pointless - for (Set<ConstraintSW *>::Element *E = area->get_constraints().front(); E; E = E->next()) { - RID self = E->get()->get_self(); - if (!self.is_valid()) - continue; - free(self); - } area->clear_constraints(); - area->set_space(space); }; @@ -494,14 +487,7 @@ void PhysicsServerSW::body_set_space(RID p_body, RID p_space) { if (body->get_space() == space) return; //pointless - for (Map<ConstraintSW *, int>::Element *E = body->get_constraint_map().front(); E; E = E->next()) { - RID self = E->key()->get_self(); - if (!self.is_valid()) - continue; - free(self); - } body->clear_constraint_map(); - body->set_space(space); }; |