more debugging for collision sovler
This commit is contained in:
parent
c7e6b2aa29
commit
74369d88fe
7 changed files with 71 additions and 36 deletions
12
src/player.c
12
src/player.c
|
|
@ -41,11 +41,13 @@ void player_start(Player* self) {
|
|||
float ex_w = 0.1f;
|
||||
float h = .75f;
|
||||
float r = 0.05f;
|
||||
float rr = (r/3)*2;
|
||||
|
||||
self->shape = shape_new((Vector[]){
|
||||
{r-ex_w, 0.f}, {-ex_w, -r},
|
||||
{-ex_w, r-h}, {r-ex_w, -h},
|
||||
{ex_w-r, -h}, {ex_w, r-h},
|
||||
{ex_w, -r}, {ex_w-r, 0.f},
|
||||
{r-ex_w, 0.f}, {-ex_w, -rr},
|
||||
{-ex_w, rr-h}, {r-ex_w, -h},
|
||||
{ex_w-r, -h}, {ex_w, rr-h},
|
||||
{ex_w, -rr}, {ex_w-r, 0.f},
|
||||
}, 8);
|
||||
|
||||
physics_world_add_entity(Player_as_PhysicsEntity(self));
|
||||
|
|
@ -54,7 +56,7 @@ 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};
|
||||
rigidbody_accelerate(self->rigidbody, vmulff(vsubf(velocity_target, velocity), 200.f));
|
||||
rigidbody_accelerate(self->rigidbody, vmulff(vsubf(velocity_target, velocity), 20.f));
|
||||
}
|
||||
|
||||
void player_collision(Player* self, Collision hit) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue