From 5955526b25511c1f221dff118193ef6dd031272d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 29 Aug 2018 08:37:08 +0200 Subject: [PATCH] Fix operator precedence in PhysicsBody2D::set_weight Fixes #16038. (cherry picked from commit 3b01bf94adb2412a2af5c5e17bbf71e320af37c1) --- scene/2d/physics_body_2d.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 33b0e2f63e0..a95a230f11f 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -536,12 +536,12 @@ real_t RigidBody2D::get_inertia() const { void RigidBody2D::set_weight(real_t p_weight) { - set_mass(p_weight / real_t(GLOBAL_DEF("physics/2d/default_gravity", 98)) / 10); + set_mass(p_weight / (real_t(GLOBAL_DEF("physics/2d/default_gravity", 98)) / 10)); } real_t RigidBody2D::get_weight() const { - return mass * real_t(GLOBAL_DEF("physics/2d/default_gravity", 98)) / 10; + return mass * (real_t(GLOBAL_DEF("physics/2d/default_gravity", 98)) / 10); } void RigidBody2D::set_friction(real_t p_friction) {