diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-12-12 16:22:43 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-12-12 16:22:43 +0100 |
commit | f1650941336db0b1b5152dc900022e99853770ed (patch) | |
tree | 0e3f75b21fe18e57c75b06995edd77e31dbf8214 | |
parent | b6ed980b0374868868ac274ed46a1a823c10db4f (diff) |
updated constraints
-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); } |