Jump to content
  • Advertisement


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



This topic is 5416 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all it''s been awhile. And i''m back with another newbie question. *celebrations*. How are bullets in 3d games written? I mean it sounds simple enough but, is it and actual projectile with volocity and a collision check or is it just a vector that is writen: "if anything is in that line it would be hit" ?. I would much rather if someone that actually knows the answer to explain *not someone that think they know.*Or if there are any demos or tutorials on how this works plz point me to it. . Thx. If a turkey spots you in the middle of the night, HIT THE DIRT !!!

Share this post

Link to post
Share on other sites
Its a line with a timer if im not mistaken, a simple line would be hitting people who moved into that line after a real bullet would have passed, so as far as i know, the best way is with a line and a timer to determine where on the line it is


Yes I realize im a n00b...

Share this post

Link to post
Share on other sites
Well, that is a hack that works, but not very accurate.

Bullets have different sizes, think of the difference between a rifle or a shotgun, or a lazer etc.

It''s not very hard to mimic a bullet, just make a sphere representing its'' size (smaller sphere for a rifle, larger for a shotgun) and make it travel along the initial position (usually the players position) + a velocity.

To figure the vector, you can do 2 different things.

1. If you want to look at the target, simply use the Look vector in your view.

2. For a sight of some sort that you move around, use that vector-position.

The velocity is based on how fast you want the bullet to travel.

A Bigger sphere has a higher chance of hitting the target(in the case of a shotgun) but has a smaller velocity.

One more thing to take into account is how far a bullet travels, You can do this with a simple multiplier, that shrinks over time.

FOR EXAMPLE HERE, say a bullet starts out at 500 feet/sec. and for every second it loses 100 feet/sec speed.

You would simply multiply that modifier by the velocity vector.

So finally you would have BulletPosition=Origin+(NormalizedVelocity*Speed);

NOw, sometimes you see in games where the "bullet" misses and sticks in the wall? THis is simply (usually) a texture overlay.

Hope this answered some questions!

Share this post

Link to post
Share on other sites
Yes. Thanks for these two replies. I just thought it was something I had to know. This question realy arised after playing unreal tornament with a sniper riffle. I made me wonder. lol. Well I have a few weeks off.. so my main goal is to try and learn dx or opengl and make a simple test scene with a target.I''m going to need alot of help with this. I''m looking into buying a couple of "new" books. but are there any with examples or tutorials of bullets. If not online? I checked here already but couldn''t find any on the topic. Any help would be greatly appreciated.
Oh and btw, have anyone played "Shadow force ''Razor Unit''? . Those bullet effects are awsome. The sounds are accurate and it makes a very cool suspence when you play. Anywho... that all i have to say now.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!