Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by CallToAdventure · Dec 14, 2010 at 12:42 PM · bullettrace

Bullet Tracer for Machine Gun

Hi everyone

I am scratching my head here trying to find the right question for what I need. My searches for 'bullet tracer' result in all kinds of solutions and directions to generic documentation. My problem is relatively simple (or so I think) - I need a visual hint for the bullets, or 'bullet tracer'. Please point me in the right direction so I can learning a bit more about unity. Thanks!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by 3dDude · Dec 14, 2010 at 02:01 PM

Are you using the fps tutorial script?

If you are using real bullets instead of rayCasts it will be easer.

If you are using real bullets then you should add Components/Misc/lineRenderer to your bullet object...

for the material create a new material and set the shader to particles/Additive. Then create a gradient in photoShop or Gimp that looks like this(you can use this one if you like):

http://yfrog.com/45basicparticlep

here is a pic of all the settings as they should be:

http://yfrog.com/b5screenshot20101214at859p

make this object a child of the bullet object prefab...

hope this helps! and just comment if you are using the FPS tutorial script or somthing else..

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image The_r0nin · Dec 14, 2010 at 02:07 PM 0
Share

This is what I meant by a billboarded texture. It works very well, and you can parent other objects to it (unlike individual particles afaik)...

avatar image CallToAdventure · Dec 14, 2010 at 02:45 PM 0
Share

I should've mentioned indeed - I am using the stock script; not sure how to make real bullets though but I will try.

avatar image
1

Answer by The_r0nin · Dec 14, 2010 at 02:05 PM

Are your "bullet" attacks simply raycasts at the moment? If so, you have a number of different options. You could create a 2D texture and apply it to a particle emitter (if you are looking for a machine gun type effect). Simply create a prefab object and put a particle emmitter on it (with the particles coming out at high energy and on the local z-axis [something like (0,0,500) for the local velocity]. Then instantiate the prefab with the player's position and rotation (moving it slightly so that it is at the tip of your gun model) and put a script on the prefab to have it destroy itself after 1 second or so. Then do your raycast for the actual hitting (the particles would only be for show. You could make them a trigger and create damage as well... but that's a different question)

Or, if you wanted to (and have the graphics overhead available) you can do what I do and every so often while raycasting for my bullet-hits, I instantiate a prefab that has a simple 3D model of a rounded cylinder with a point-light parented to it. I then script it to destroy itself after a certain time/distance and pick an appropriate shader, and it looks pretty good. I fire this kind of tracer less often than a particle emitter (you could use the same technique with billboarded textures for less graphics hit), but I like the light effect of the point light on the tracer.

Just some ideas...

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CallToAdventure · Dec 14, 2010 at 02:59 PM 0
Share

I did something along these lines: added the spark stock particles and made them stretched billboard. The effect could be working but the particles are not getting destroyed (autodestruct wont render them at all) and they are aligned to one direction only; here are the settings:

world velocity - z - 0.005 emitter velocity scale - 4

trouble is they are not rendered when I shoot upwards, and there's no collider for the hit.

avatar image CallToAdventure · Dec 14, 2010 at 03:01 PM 0
Share

added local velocity on the z axis as well but the particles never align with the camera, they are 'shot' from the same direction always.

avatar image CallToAdventure · Dec 14, 2010 at 03:17 PM 0
Share

Almost there;

local velocity z - 300 emitter velocity scale 100 stretch particles - stretched lenght scale - 100

However, the initial issue remains, if there's nothing to hit, the tracers are not rendered; not a big thing; also the particle aligns itself randomly with coliders in scene ins$$anonymous$$d of just pointing always forward from the player.

avatar image The_r0nin · Dec 14, 2010 at 04:12 PM 0
Share

Try putting a particle collider (http://unity3d.com/support/documentation/Components/class-WorldParticleCollider.html) on the object and set the particle energy loss to a large number, and a high $$anonymous$$in $$anonymous$$ill Velocity. This way when your particles hit something, they will slow down and be destroyed almost instantly.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

recoil and bullet tracer 2 Answers

when the bullet hits the bot it still makes the bullet hole 1 Answer

Troubles with 2D projectiles 1 Answer

Shoot 10 bullets at once 1 Answer

How do I make the bullet do damage 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges