Path: chuka.playstation.co.uk!scea!peter_alau@playstation.sony.com From: "Antony Arciuolo" Newsgroups: scee.yaroze.programming.2d_graphics Subject: 2d Collision detection Date: Wed, 7 Oct 1998 16:04:35 -0400 Organization: SCEA News Server Lines: 42 Message-ID: <6vggm5$6uj2@scea> NNTP-Posting-Host: aarciuol.pc.trincoll.edu X-Newsreader: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 I am using bounding box collision detection something to the effect of the code listed below. Now my problem is I got my guy scooting along at a speed of 5, so collision appears as if the guy is hitting a force field. Also if I slow down to 4,3,2,1 the force field around the other object gets smaller. How can I make so that a collision means the borders of the bounding boxes are touching and will be touching until the position is updated? void WOBJECT_Update(WOBJECT *obj) { short degrees, i; WOBJECT *obj2; // Handle position obj->oldx = obj->x; obj->oldy = obj->y; if (obj->attribute & WOBJECT_IS_MOVEABLE) { degrees = 360 - IPART(obj->currentOrientation); obj->x += (obj->currentSpeed * LUCos(degrees)); obj->y -= (obj->currentSpeed * LUSin(degrees)); for (i = 0; i < WOBJECT_ALL_COLLISION_OBJECTS; i++) { obj2 = &gAllWorldObjects[i]; if (obj != obj2 && WOBJECT_ThereIsACollision(obj, obj2)) { obj->x = obj->oldx; obj->y = obj->oldy; } } } // if should move this object }