Collision detection
Author Message
Collision detection

I've heard many ways, comparing coordinates directly, checking if a line
intercepts a rectangle and so on.  What is the _fastest_ way to check
collision?

Sat, 11 Mar 2000 03:00:00 GMT
Collision detection

Quote:

> I've heard many ways, comparing coordinates directly, checking if a line
> intercepts a rectangle and so on.  What is the _fastest_ way to check
> collision?

Hi ....
You should define what you mean by collision and probably help could be
on its way.

George
-

Mon, 20 Mar 2000 03:00:00 GMT
Collision detection

Quote:

>I've heard many ways, comparing coordinates directly, checking if a line
>intercepts a rectangle and so on.  What is the _fastest_ way to check
>collision?

objects on the screen. If one's 'space' invades the 'space' of another then a
more accurate test can be made.

DIM XY%(3,MaxObjects%)
XY%(0,n) = Left%
XY%(1,n) = Top%
XY%(2,n) = Right%
XY%(3,n) = Bottom%

FOR X% = 0 TO MaxObjects%
IF X% <> Object% THEN
IF XY%(0,Object%) => XY%(0,X%) AND _
XY%(1,Object%) => XY%(1,X%) AND _
XY%(2,Object%) =< XY%(2,X%) AND _
XY%(3,Object%) =< XY%(3,X%) THEN
.... preform secondary test
END IF
END IF
NEXT

You'll need some routine(s) to assign, update, and remove objects from the
array and keep track of which object number is to be used/assigned to each,
etc. But the above works well for quick checks.

C'ya,

____    _    ____      ____  _____
|  _ \  / \  / ___) __ | ___)(_   _)
| |_)  / _ \ \____\/  \|  _)   | |
|____//_/ \_\(____/\__/|_|     |_|

www.basicguru.com/schullian

Wed, 22 Mar 2000 03:00:00 GMT

 Page 1 of 1 [ 3 post ]

Relevant Pages