Repository navigation
Move physics to a separate file - #1775
Conversation
|
@IntegratedQuantum Should keyboard input be in |
|
The physics system should handle one thing, and one thing only: Physics |
|
Ideally we want to be able to reuse the same system for entities, which will have different input |
| const walkingSpeed: f64 = if(Player.crouching) 2 else 4; | ||
| if(KeyBoard.key("forward").value > 0.0) { | ||
| if(KeyBoard.key("sprint").pressed and !Player.crouching) { | ||
| if(KeyBoard.key("backward").value > 0.0) { |
There was a problem hiding this comment.
Git is really struggling to handle the diff here, lol
|
Ready for review |
| pub var jumpCoyote: f64 = 0; | ||
| const jumpCooldownConstant = 0.3; | ||
| const jumpCoyoteTimeConstant = 0.100; | ||
| pub const jumpCooldownConstant = 0.3; |
There was a problem hiding this comment.
Ideally it also shouldn't access these constants from the player, different entities may have different jump heights.
But that should be done in a separate PR.
Issue: #1778
| var acc = Vec3d{0, 0, 0}; | ||
| if(!Player.isFlying.load(.monotonic)) { | ||
| acc[2] = -effectiveGravity; | ||
| var acc = Vec3d{0, 0, 0}; |
There was a problem hiding this comment.
Ideally in the future, the acceleration should be calculated entirely inside the physics code, the entity should only give it a desired velocity value or something like that.
IntegratedQuantum
left a comment
There was a problem hiding this comment.
In the future it also might be worth considering to move collision outside of game as well, either also in physics.zig, or just into a separate file physics/collision.zig
Progress towards #1728