diff options
author | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-05-28 15:40:04 +0000 |
---|---|---|
committer | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-05-28 15:40:04 +0000 |
commit | 2295e1879d9c5ef869c9c5e3b1714fec0c67d799 (patch) | |
tree | a44be4c1af0ad14dd1f38559da3619276beaf557 /src/physics.c | |
parent | 58173ca471c97bc099080975c021fc720aa50140 (diff) |
Basic collision response
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@47 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src/physics.c')
-rw-r--r-- | src/physics.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/physics.c b/src/physics.c index b289b06..1277f62 100644 --- a/src/physics.c +++ b/src/physics.c @@ -189,7 +189,7 @@ static int physics_will_collide(ModelInstance *obj, ModelInstance *other, Uint32 if ( physics_will_collide_face(sx, sy, sz, vx, vy, vz, nx, ny, nz, face, 4, dt, other) != 0 ) { - printf("collides with %s/%p\n", other->model->name, other); + //printf("collides with %s/%p\n", other->model->name, other); return 1; /* Don't waste time looking anywhere else */ } } @@ -221,9 +221,9 @@ static void physics_process(ModelInstance *obj, Uint32 dt, Game *game) { for ( j=0; j<room->num_objects; j++ ) { if ( physics_will_collide(obj, room->objects[j], dt) ) { /* Stop the object in its tracks and return */ - obj->vx = 0.0; - obj->vy = 0.0; - obj->vz = 0.0; + obj->vx = -obj->vx; + obj->vy = -obj->vy; + obj->vz = -obj->vz; obj->yawspeed = 0.0; return; } |