Page 1 of 1

Best way to test for bullet collide with moving object?

Posted: Thu Mar 25, 2004 3:24 am
by Domarius
I am using the examples as starting points for everything I try.

I noticed the bullets in the TechDemo are fired using an animate function. A line collision tests where the wall is where the player is looking, and the start of the animation is set to the camera position, and the end of the animation is where the collision with the wall is. When the bullet reaches the end of the animation, it explodes.

This seems really efficient, but what about for testing collision between moving objects?

The only way I know how to do this is test the bullet position for an overlap with the aabounding box of the moving object. To do this, I'd have to check every bullet against every moving object that is active.

Is there a better way? I found this related post, but I don't understand it because it involves somethings called "triangle selectors" - a term which I'm not familar with yet (but am willing to learn)

Posted: Thu Mar 25, 2004 3:31 am
by Caecus
"To do this, I'd have to check every bullet against every moving object that is active."

Yep, you would. There is no way to tell if a bullet collides if you dont test it. And since you have multiple entities your going to have to test against all of them.

Posted: Thu Mar 25, 2004 7:41 am
by Domarius
All good. Thanks, I just wanted to check I wasn't missing out on some new, really efficient way. (besides seperating the level into grid cells and only checking against all objects in the current cell, which I'm going to do anyway)