Hey, im working on a game, thats a side scrolling shooter, kind of like defender. Of course its in 3d though. I had a question about collisions, what would be the fastest way to detect a collision between my ship, and say a bunch of asteroids. There will be probably about 30 or 40 asteroids at a time of different sizes and shapes. What do i do to detect when i hit one? It needs to be fast. Ive never used colisions before so treat me like an idiot. Thanks in advance.
Magical Collisions
Blitz3D Forums/Blitz3D Programming/Magical Collisions From the BB Help Archives (supplied with your software)
To perform a simple function upon colision (this, ofcoarse coming out of the code above) study the code below
Graphics3D 800,600 Const CUBE_COL=1 Const SPHERE_COL=2 SetBuffer BackBuffer() camera=CreateCamera() CameraViewport camera,0,0,800,600 PositionEntity camera,0,0,-5 light=CreatLight() cube=CreateCube() PositionEntity cube,-5,0,5 EntityColor cube,70,80,190 EntityType cube,CUBE_COL sphere=CreateSphere(12) PositionEntity sphere,5,0,5 EntityColor sphere,170,80,90 EntityType sphere,SPHERE_COL Collisions SPHERE_COL,CUBE_COL,3,1 While Not KeyHit(1) MoveEntity sphere,-0.02,0,0 UpdateWorld RenderWorld If EntityCollided(sphere,CUBE_COL) Then Text 370,80,"Collided !!!" EndIf Text 335,500,"Collision Detection" Flip Wend End
To perform a simple function upon colision (this, ofcoarse coming out of the code above) study the code below
If EntityCollided(sphere,CUBE_COL) Then Text 370,80,"Collided !!!" EndIf