• 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
3
Question by techshaman · Jul 25, 2012 at 03:12 PM · particle

Starfield from Particle Emitter/System

I am trying to create a starfield effect in unity. Basically I want a particle system to be emitting lengthy particles in the direction of the plane the camera is facing. Ideally I would be able to update already-spawned particles if the camera rotates.

How can I find the direction the particles should travel (towards the plane of the camera?)

How do I update particle direction via a script?

Also not totally sure of the difference between a Particle Emitter vs Particle System - is there a particular reason to be using one over the other?

I'm relatively new to scripting and unity - been trying my hand with a few tutorials and mocking up some basic scenes. Thanks for any help!

Comment
Add comment · Show 2
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 TheCodeMonkey · Jul 25, 2012 at 03:37 PM 0
Share

I am not exactly sure what you are asking for, is what you are trying to do similar to something like particles flying at the screen itself? or just flying out into space from the camera in the direction it is facing?

avatar image techshaman · Jul 25, 2012 at 03:44 PM 0
Share

Particles should be moving towards the camera.

However, they should not move directly towards the point in space the camera is located (all particles would just appear to converge on the camera). Ins$$anonymous$$d particles need to move in the direction of the camera, as if the camera was a giant plane in space (towards the face of the camera) - this way particles will appear to 'fly by' the camera.

Is that clarification helpful? I am not sure how I would need to compute Vectors or Directions for this effect.

1 Reply

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

Answer by TheCodeMonkey · Jul 25, 2012 at 04:00 PM

Thank you for clarifying that told me exactly what I needed to know.

The TLDR is that by making the particle system a child of the camera you don't need to do any extra work and the engine itself will handle making sure the particles are always going in the right direction in relation to the camera.

The effect you are trying to achieve sounds relatively complex when you first think of it and it might even sound like there is a lot of math involved. However thanks to the Unity parent/child gameobject system something like that is INCREDIBLY easy.

To set it up:

  1. Create an empty GameObject and place it within your Camera as a child object(you can also do this with a particle system instead of an empty gameobject however I am unfarmiliar with them so I will tell you how to set it up with legacy particles). Either way reset the position of whichever you chose

  2. Place this empty gameobject or particle system infront of your camera and an appropriate distance(whatever is right for the effect you want)

  3. Add 3 components to it

component>effects>legacyParticles>elipsoidemmitter

component>effects>legacyParticles>particleanimator

component>effects>legacyParticles>particlerenderer

  1. most of the work from here is on the emitter use the render and the animator to setup the look of your particles

to set up the emitter to get the effect you want:

Set your max and min emission to something high(300-400ish)

Set your local velocity to 0,0, -30ish

then set your ellipsoid to 10,10,0

I have a test scene setup right now giving the effect you described with this formula to get it. although I would recommend using the particle system as opposed to the legacy components I described as they are probably very good to learn.

Hope this helps.

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 techshaman · Jul 25, 2012 at 05:06 PM 0
Share

Thank you for the detailed response! I found this very helpful.

avatar image tperry1x · Jan 23, 2013 at 07:48 PM 0
Share

Amazing! This was exactly what I was looking for. Thank you!

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

7 People are following this question.

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

Related Questions

A node in a childnode? 1 Answer

Items with Statistics(such as attack damage) that actually effect the character? 2 Answers

I have a problem with my parkour C# script on final lines 0 Answers

android unity script can't work 0 Answers

How do i put lights with muzzleflash? 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