Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Delta6 · Dec 17, 2016 at 10:52 AM · movementparticlesscripting beginnertroubleshooting

how to make particles activate when object moves

hello I have a very good Question for you smart scripters, since I don't do scripting (only modeling) I have come back to the community for answers. My question is how do you create a script the activates particles when a object with this script starts to move and deactivates when it stops moving.

If you guys could help me with this that would be great.

Thanks. ,

Comment
Add comment · Show 1
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 markrashera · Dec 17, 2016 at 11:12 AM 0
Share

It would be helpful if you would include the actual movement script.

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by aditya · Dec 17, 2016 at 11:12 AM

For two cases ...

  1. If your object is a rigidbody then check for Rigidbody.velocity, if it is more than zero it means your object is moving, if zero than it is still

  2. If your object is not a rigidbody then check for its current and old position in each frame (or in whatever manner you want it to happen), if current and old positions are same than it is still, else its moved

    Accept if it solved your problem

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 markrashera · Dec 17, 2016 at 11:26 AM 0
Share

And if it uses CharacterController you can check for characterController.velocity.magnitude > 0

avatar image Delta6 · Dec 19, 2016 at 12:22 AM 0
Share

ok so it has a rigidbody. just to let you know. what it is, is a ship so what I'm trying to figure out is how to create a script in JS that would activate on the particles when the Rigidbody starts to move.......so what your saying is that if I use Rigidbody.velocity it would activate the particle system in the prefab. When its moving of course. :P

Yes?

avatar image aditya Delta6 · Dec 19, 2016 at 05:32 AM 0
Share

Rigidbody.velocity will return you a value and you had to check if that value is more than 0 then play the particles if it is equal to 0 then stop the particles

avatar image Delta6 · Dec 19, 2016 at 08:29 AM 0
Share

ok so it has a rigidbody. just to let you know. what it is, is a ship so what I'm trying to figure out is how to create a script in JS that would activate on the particles when the Rigidbody starts to move.......so what your saying is that if I use Rigidbody.velocity it would activate the particle system in the prefab. When its moving of course. :P

Yes?

avatar image
1

Answer by ifurkend · Dec 26, 2016 at 01:29 PM

Actually you can achieve similar effect without script by using "emission over distance" (keep in mind this is mildly broken in Unity 5.5.0 and awaits next patch) instead of "emission over time", so particles are only generated when the object moves.

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
avatar image
0

Answer by Bren0831 · Dec 19, 2016 at 08:30 AM

I would try instantiating the particles if your movement input is down. Also look into line renderers if that is the kind of thing you are looking for.

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

7 People are following this question.

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

Related Questions

Force Movement on a Path with Path Switching? 0 Answers

Merging pathfinding and following the player Scripts 0 Answers

UNITY 3D: How to make the camera follow the player? Smoothly 2 Answers

How to stop an object at a specific position for certain time in it's motion and then let continue it's motion? 0 Answers

How do i change the player camera to a free view? 0 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