From d85b67be53bac252c0a28b799d56d1b359c4ee99 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 2 Nov 2014 11:31:01 -0300 Subject: Bug Fixes -=-=-=-=- -Fixed problem with scaling shapes (#827), related to not taking scale in consideration for calculating the moment of inertia -Added support for multiline strings (or comments) using """ -Save subscene bug, properties not being saved in root node (#806) -Fix Crash in CollisionPolygon2DEditor (#814) -Restored Ability to compile without 3D (#795) -Fix InterpolatedCamera (#803) -Fix UV Import for OBJ Meshes (#771) -Fixed issue with modifier gizmos (#794) -Fixed CapsuleShape gizmo handle (#50) -Fixed Import Button (not properly working in 3D) (#733) -Many misc fixes (though no new features) --- servers/physics_2d/body_2d_sw.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'servers/physics_2d/body_2d_sw.cpp') diff --git a/servers/physics_2d/body_2d_sw.cpp b/servers/physics_2d/body_2d_sw.cpp index fbad19f6be..591bf046ef 100644 --- a/servers/physics_2d/body_2d_sw.cpp +++ b/servers/physics_2d/body_2d_sw.cpp @@ -65,7 +65,13 @@ void Body2DSW::update_inertias() { float mass = area * this->mass / total_area; - _inertia += shape->get_moment_of_inertia(mass) + mass * get_shape_transform(i).get_origin().length_squared(); + Matrix32 mtx = get_shape_transform(i); + Vector2 scale = mtx.get_scale(); + _inertia += shape->get_moment_of_inertia(mass,scale) + mass * mtx.get_origin().length_squared(); + //Rect2 ab = get_shape_aabb(i); + //_inertia+=mass*ab.size.dot(ab.size)/12.0f; + + } -- cgit v1.2.3