mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Fix operator precedence in PhysicsBody2D::set_weight
Fixes #16038.
(cherry picked from commit 3b01bf94ad)
This commit is contained in:
@@ -536,12 +536,12 @@ real_t RigidBody2D::get_inertia() const {
|
|||||||
|
|
||||||
void RigidBody2D::set_weight(real_t p_weight) {
|
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 {
|
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) {
|
void RigidBody2D::set_friction(real_t p_friction) {
|
||||||
|
|||||||
Reference in New Issue
Block a user