diff options
Diffstat (limited to 'src/crepe')
-rw-r--r-- | src/crepe/system/PhysicsSystem.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/crepe/system/PhysicsSystem.cpp b/src/crepe/system/PhysicsSystem.cpp index 5629809..38deb43 100644 --- a/src/crepe/system/PhysicsSystem.cpp +++ b/src/crepe/system/PhysicsSystem.cpp @@ -41,7 +41,7 @@ void PhysicsSystem::update() { throw std::runtime_error("Config Gravity must be greater than 0"); } - if (rigidbody.data.gravity_scale > 0) { + if (rigidbody.data.gravity_scale > 0 && !rigidbody.data.constraints.y) { rigidbody.data.linear_velocity.y += (rigidbody.data.mass * rigidbody.data.gravity_scale * gravity * dt); @@ -53,13 +53,15 @@ void PhysicsSystem::update() { } // Add coefficient movement horizontal - if (rigidbody.data.linear_velocity_coefficient.x > 0) { + if (rigidbody.data.linear_velocity_coefficient.x > 0 + && !rigidbody.data.constraints.x) { rigidbody.data.linear_velocity.x *= std::pow(rigidbody.data.linear_velocity_coefficient.x, dt); } // Add coefficient movement horizontal - if (rigidbody.data.linear_velocity_coefficient.y > 0) { + if (rigidbody.data.linear_velocity_coefficient.y > 0 + && !rigidbody.data.constraints.y) { rigidbody.data.linear_velocity.y *= std::pow(rigidbody.data.linear_velocity_coefficient.y, dt); } |