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?

If _speed_ is your major concern then start with a look-up table of all the
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  
 
 [ 3 post ] 

 Relevant Pages 

1. Collision detection routines between images

2. Sprites and collision detection

3. Collision detection problems w/ scrolling?

4. Collision detection

5. VB InterSectRect Collision detection...

6. Help with collision detection (rectangular)

7. Collision Detection

8. collision detection

9. Collision Detection Problems

10. Collision Detection in VB5

11. High speed sorting and collision detection.

12. Collision Detection in VB4

 

 
Powered by phpBB® Forum Software