diff options
author | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-07-17 23:52:30 +0000 |
---|---|---|
committer | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-07-17 23:52:30 +0000 |
commit | 4f1c5d440d76dfa13fc78f385912dcde8d5495fa (patch) | |
tree | b525f721510ebf262c01c7df6fcefc0cd40de6f7 /src | |
parent | 9e92105657f48973da9522feccc665bbd3cb5b86 (diff) |
Take yaw into account to calculate proper starting coords for collision detection
Set yawspeed to zero on landing
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@140 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src')
-rw-r--r-- | src/physics.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/physics.c b/src/physics.c index c6d4dd9..8299704 100644 --- a/src/physics.c +++ b/src/physics.c @@ -194,8 +194,10 @@ static int physics_check_collide(ModelInstance *obj, ModelInstance *other, doubl for ( j=0; j<obj->model->primitives[i]->num_vertices; j++ ) { int a; - const double sx = obj->model->primitives[i]->vertices[3*j+0]; - const double sy = obj->model->primitives[i]->vertices[3*j+1]; + const double stx = obj->model->primitives[i]->vertices[3*j+0]; + const double sty = obj->model->primitives[i]->vertices[3*j+1]; + const double sx = stx*cos(obj->yaw) + sty*sin(obj->yaw); + const double sy = -stx*sin(obj->yaw) + sty*cos(obj->yaw); const double sz = obj->model->primitives[i]->vertices[3*j+2]; /* ...against all primitives in the static object */ @@ -305,6 +307,7 @@ static void physics_process(ModelInstance *obj, Uint32 dt, Game *game) { obj->vx = 0.0; obj->vy = 0.0; obj->vz = 0.0; + obj->yawspeed = 0.0; } else { /* No - bounce */ audio_play(game->audio, "clang", 1.0, 0); |