Archived

This topic is now archived and is closed to further replies.

DevLiquidKnight

What is used for bullets?

Recommended Posts

I have a 3D envoriment and im trying to figure out what exactly is used as projectiles. I was wondering what is used for things like bullets in games as well as lazers and such. I also am wondering how exactly do you set it up so when you fire the bullet it moves through the distance in the correct direction you shot it at. Does anyone have any sites that show how this concept is done in a 3D envoriment using Open GL or do they have any information on how this is done. I also was wondering if the collision detection for 3D games are automaticly set up to have collsion detection implement. I mainly want to know this because I have seen a few basic demonstrations of 3D worlds and yet they have no collsion detection in the game that I have seen it seems as if the loading of a 3D model of the landscape then texturing it made it so that the collision detection was automatic. [edited by - DevLiquidKnight on November 5, 2002 1:09:43 PM]

Share this post


Link to post
Share on other sites
adding good collision detection is normally harder than getting the polygons on the screen in the first place. thats the reason a lot of demos dont do it (not to mention doing graphics is normally more fun )
myself i treat bullets as a particle system (though a lot of ppl dont ie they have a special bullets structure)
since my particlesystem is pretty broad + can handle collisions of particles against the world, this does work out nicely for me.

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
the biggest problem with physics for bullets is that if you treat it as a particle then bullets can go through things if the timestep is small enough and the velocity of hte bullet is high enough.

personally i prefer the hitscan method where i just trace a line and check for intersections. Alternatively you can apply a parabolic curve to the line to simulate drop off, or treat it as a particle and trace lines between each timestep...

some engines have a physics engine behind it with a very high timestep so that collisions are always handled correctly.

like most things there is not a right or wrong answer but just one that is best suited for you...

-jonnii

Share this post


Link to post
Share on other sites
i dont have time to write a quick demo (exams & assignments) but anyway, you create a vector that the bullet will follow, and a displacement (the muzzle of your gun). Now im pretty sure that most games treat bullets as instant hit, in which case you (as mentioned before) trace the line from the start of the projectiles path, along the aim vector. Apon first contact you generally stop the trace, although this can be altered for ''penetration'' (no jokes you filthy ppl). Of course if you want to allow for a bullet''s fall over a distance (gravity DOES affect bullets, and a fair bit mind you) you need to trace with a parabolic curve which can be a problem. For a bullet that is not instant hit, a particle can be used as a storage medium (as said b4) and you trace it from its start thru to the end of its movement PER frame, until it is to be taken out of existence.

As for your collision detection methods, a very quick & simple method of reducing your checks is only checking polygons that face the projectile.

Anyway enough rambling, i hope this helps.

Share this post


Link to post
Share on other sites
Max Payne''s slow-mo sequences are perhaps the best examples (since it''s in slow motion you get to really examine how they achieved the result). You might be exposed to extreme ''dramatic'' camera flipflopping though.

Gravity over time might be a little bit of accuracy-overkill, I doubt many gamers would notice it.



MatrixCubed
http://MatrixCubed.cjb.net

Share this post


Link to post
Share on other sites