implemented velocity verlet integration

This commit is contained in:
Sara 2023-10-18 22:51:56 +02:00
parent 2b1014e603
commit 37b1fc3228
6 changed files with 75 additions and 29 deletions

View file

@ -55,8 +55,9 @@ void player_start(Player* self) {
void player_update(Player* self, float dt) {
Vector velocity = rigidbody_get_velocity(self->rigidbody);
Vector velocity_target = {directional.x, directional.y};
Vector velocity_target = {directional.x, velocity.y};
rigidbody_accelerate(self->rigidbody, vmulff(vsubf(velocity_target, velocity), 20.f));
rigidbody_accelerate(self->rigidbody, (Vector){0.0f, 20.f});
}
void player_collision(Player* self, Collision hit) {