Jump to content
  • Advertisement

Archived

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

Mark Tanner

Bullet tracer FX

This topic is 5222 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, I''m trying to add a ''bullet tracer'' effect when you fire a gun. (There are probably a few ways of doing this). It''s basically a long streak of light following the bullet. I have a simple model representing the light trace and I render this at the bullet''s position. So this works, but since the model is long (it''s a tracer after all), it needs to be oriented towards the bullet''s direction. Since that direction doesn''t really change once fired, I thought: Position = weapon''s position, Target = target''s position, and Up vector = (0,1,0). And then I could use D3DXMatrixLookAtLH to create the rotation matrix for the tracer, aligned along the bullet''s path. But this doesn''t work correctly. What am I doing wrong? Thanks for any suggestions, Mark

Share this post


Link to post
Share on other sites
Advertisement
Minor distinction, a tracer only LOOKS long because it blurs across our vision. It''s still the same size as a normal bullet.

the vector of travel (target-position) will be parallel to the direction the "tracer" must follow.

How exactly is it not working? Is the tracer at a 90 degree angle to the desired angle, or some other predictable behavior? Perhaps you will find what you are looking for by analyzing the scene a little bit.

Don''t forget to normalize your direction vector for the bullet. Without a normalized direction vector, you can have funky results.



capn_midnight | Captain Midnight | deviantArt
ACM | SIGGRAPH | Generation5

Share this post


Link to post
Share on other sites
Hi,

OK, its true in real life the tracer isn''t long but I need to approx. the resulting visuals.

Basically what I''m asking is this:
I need to make the tracer model be oriented along the bullet''s direction; to get the model''s matrix from the direction (target-position).

So I thought I could make the matrix by using a lookat matrix, but is this the way to do it?

Thanks,

Mark

Share this post


Link to post
Share on other sites
Ironically, someone asked a pretty similar question (about generating glowing engine glows). You might find this interesting, especially the "Axial Billboard" part. Basically, you generate a trail (textured quad with a comet-like texture would be good in your case, I suppose) from the bullet''s position and then orient it towards the viewer by rotating it around the bullet''s movement vector.

You should be careful not to use too long trails if you''re implementing gravity and other influence on the path, so that the trace does not visibly go off tangentially from the trajectory.

Share this post


Link to post
Share on other sites
Hi,
why not store the bullet''s position of the previous Frame (maybe even more frames) and draw lines between them? you could set the alpha value of the line so that the "oldest" position is faded with the scenery. I have implemeted this and it looked pretty cool

--::[Madhed]::--

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!