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-07 4:05

Man, all these people are retards.

Yes you can do it that way, and yes it's fairly slow. As for determining what to do as the result of a collision, depending on the system you're using it may or may not be of use.

Another shitty way of doing it is rendering the scene to the back buffer with solid colors then flipping a single pixel to the front buffer and seeing what color it is.

An alternative to this is the excellent ColDet library which will do this sort of thing better, or Open Dynamics Engine which is a full physics simulator but rather complex to use.

Or you can always use the common vector approximations like boxes, cylinders, and spheres - they're simple enough to write - but I personally can't stand games that use them as they are too inaccurate.

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