implemented velocity verlet integration
This commit is contained in:
parent
2b1014e603
commit
37b1fc3228
6 changed files with 75 additions and 29 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue