aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/PhysicsSystem.cpp
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2024-12-02 17:17:21 +0100
committerJAROWMR <jarorutjes07@gmail.com>2024-12-02 17:17:21 +0100
commiteeb66130e2cb94c94e1748576f98f78ce0f1ee86 (patch)
treef3a8a09b9f9245f559d1c924a7eccead5434f979 /src/crepe/system/PhysicsSystem.cpp
parentd06e05d0d8dbe1ace63b439231ccd05a975e9834 (diff)
changed some values because of feedback and merged from master
Diffstat (limited to 'src/crepe/system/PhysicsSystem.cpp')
-rw-r--r--src/crepe/system/PhysicsSystem.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/crepe/system/PhysicsSystem.cpp b/src/crepe/system/PhysicsSystem.cpp
index 514a4b3..8f21727 100644
--- a/src/crepe/system/PhysicsSystem.cpp
+++ b/src/crepe/system/PhysicsSystem.cpp
@@ -25,17 +25,17 @@ void PhysicsSystem::update() {
if (transform.game_object_id == rigidbody.game_object_id) {
// Add gravity
- if (rigidbody.data.use_gravity) {
+ if (rigidbody.data.gravity_scale > 0) {
rigidbody.data.linear_velocity.y
+= (rigidbody.data.mass * rigidbody.data.gravity_scale
* gravity);
}
// Add damping
- if (rigidbody.data.angular_damping != 0) {
- rigidbody.data.angular_velocity *= rigidbody.data.angular_damping;
+ if (rigidbody.data.angular_velocity_factor != 1 && rigidbody.data.angular_velocity_factor > 0) {
+ rigidbody.data.angular_velocity *= rigidbody.data.angular_velocity_factor;
}
- if (rigidbody.data.linear_damping != vec2{0, 0}) {
- rigidbody.data.linear_velocity *= rigidbody.data.linear_damping;
+ if (rigidbody.data.linear_velocity_factor != vec2{1, 1} && rigidbody.data.linear_velocity_factor.x > 0 && rigidbody.data.linear_velocity_factor.y > 0) {
+ rigidbody.data.linear_velocity *= rigidbody.data.linear_velocity_factor;
}
// Max velocity check