Skip to content

Commit

Permalink
fixed moving on platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
nem0 committed Nov 20, 2024
1 parent 87f498f commit a90a13c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/physics/physics_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1769,8 +1769,11 @@ struct PhysicsModuleImpl final : PhysicsModule
}
else {
controller.gravity_speed = 0;
// we need to apply gravity here otherwise the controller won't ride on horizontally moving platforms
dif.y = 0.5f * gravity_acceleration * time_delta * time_delta;
// if dif.y > 0, somebody is trying to move the controller up (e.g. jump), we should not allow that
if (dif.y <= 0) {
// we need to apply gravity here otherwise the controller won't ride on horizontally moving platforms
dif.y = -0.05f;
}
}

m_moving_controller = controller.entity;
Expand Down

0 comments on commit a90a13c

Please sign in to comment.