Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

let OpenGL do bullet collision?

Name: Anonymous 2006-09-06 0:11

this is something that's been on my mind but I can't find much information on this on Google (which leads me to believe that it's probably not a good idea if nobody else has thought of it).

Umm... okay say I have a scene with a bunch of enemies and other moving models.  And I want to implement localized damage (shoot enemy in the foot, or in the shoulder, etc... specific places).

Is there any reason I can't do this by using GL_SELECT rendering mode in an auxiliary buffer?  like when a shot is fired, render everything like normal as always, but then, in an unseen auxiliary buffer, switch the "camera" to your gun's point-of-view, and then draw the models to the namebuffer (remember this is GL_SELECT rendering mode so things like textures, lighting, even regular won't cause overhead because they're not drawn -- just flat polygons with "names" associated with them).  And then if there's any hits in the auxiliary buffer upon a shot, take the identity of the hit polygon and figure out which body part of a model got hit?

this probably is useless for true collision (as in physics, bouncing, etc) but I thought it might be a neat solution to registering bullet-shots on dynamic entities in a scene.

has anyone ever done bullet-collision this way?

Name: Anonymous 2006-09-06 15:58

You'd be rendering the scene twice, which is pretty WRONG. Although on modern hardware, writing a shitty game, you can probably get away with something like this, there are more elegant ways to model the movement and collision of fast-moving objects like bullets. I think that most games use ray-casting for this sort of thing, which is where you represent the path of the bullet with a ray and then perform collision detection on that. Note that performing a ray-intersection test with every triangle in a scene is hardly realistic, so you might want to use bounding spheres, for example, as an optimization.
Also >>3

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List