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 unity_bPYT4ES2DGHFVQ · Jan 16, 2021 at 05:41 AM · flashlight

Dust in light from flashlight

Good day! I'm trying to make dust in the light from the flashlight in the player's hand. I do this with the help of a Particle System with simulation in World Space. In general, if the player stands still, everything looks great. But when the player moves, the effect of drawing with particles occurs, associated with the lifetime of the particles. Is it possible to somehow track the exit of a particle outside the shape (in my case, a cone), and then remove it? Or can you only create a special collider (for example, from several spheres to get closer to the shape of a cone, since unfortunately there is no cone primitive in Unity) and track the exit of particles from it? Another option came to my mind: create a particle system that fills the entire level with dust particles. They are slightly visible by default. But when they hit the flashlight collider, the particles change to bright yellow.

Please tell me which of these options are feasible? Is there a smarter way to do this?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by unity_bPYT4ES2DGHFVQ · Jan 17, 2021 at 09:23 AM

I realized that both options are easy to implement using the Trigger module of the Particle System. For those who in the future will look for an answer to the question of how to realize dust in the light of a flashlight, I will briefly tell you:

Note: two options are possible: the first is completely without scripting and, possibly, less resource-intensive than the second, and the second is more natural and plausible.

1) Create a cone using the Parabox Primitives asset (https://assetstore.unity.com/packages/tools/modeling/parabox-primitives-18576), add the Mesh Collider to it, turn off the Mesh Renderer.

First option (a):

2a) Create a System of Particles with simulation in the World Space, the shape is a Cone, with emission of particles by Volume

3a) Activate the Triggers module. Add the previously created cone to the Collider field. Inside - ignore, Outside - kill, Enter - ignore, Exit - kill.

This will create the effect of dust getting into the beam of light in front of your flashlight.

The second way (b):

2b) Create a global particle system so that it fills the entire game space. For example, if you have a room, stretch the Cube Shape to the size of your room.

3b) Activate the Triggers module. Add the previously created cone to the Collider field. Inside - Ignore, Outside - Ignore, Enter - Callback, Exit - Callback.

4b) Add the script from this page to this Particle System (https://docs.unity3d.com/2019.3/Documentation/Manual/PartSysTriggersModule.html). Customize the color for yourself. Done.

This method will create a real effect of a dusty space, particles of dust will be illuminated by your flashlight just like in real life.

Comment
Add comment · 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

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

110 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

FlashLight Turning off, but not back on again? (Simple Script Fix?) 4 Answers

When flashlight hits invisible object, make it appear? 0 Answers

Create a flashlight 2 Answers

How to access the light component on a camera object? 1 Answer

GUI Texture Transparency issue 1 Answer


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