Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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
1
Question by _kotsos_333 · Jul 07, 2015 at 03:59 PM · physicsparticlesparticlesystem

I am trying to implement a magnetic field with particle system...

Though I managed to implement it with random objects( I expanded their collider, made it a trigger and transformed the objects), I can not find how to trigger the particles, since there is not an onTrigger option (there is also not an option where you can expand the collider of the particles and make it a trigger)

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
9
Best Answer

Answer by Mischa · Jul 07, 2015 at 09:15 PM

I'm not exactly sure what you want to achieve but I once wrote a particle attractor whitch attracts particles to a specific point. The class looks like this, maybe you can use something of it. It basically grabs the particles of a particle system and then manually changes their position based on their lifetime.

 using UnityEngine;
 using System.Collections;
 
 public class ParticleAttractor : MonoBehaviour {
     
     [SerializeField]
     private Transform _attractorTransform;
 
     private ParticleSystem _particleSystem;
     private ParticleSystem.Particle[] _particles = new ParticleSystem.Particle[1000];
 
     public override void Start ()
     {
         _particleSystem = GetComponent<ParticleSystem> ();
     }
 
     public void LateUpdate()
     {
         if (particleSystem.isPlaying) {
             int length = _particleSystem.GetParticles (_particles);
             Vector3 attractorPosition = _attractorTransform.position;
 
             for (int i=0; i < length; i++) {
                     _particles [i].position = _particles [i].position + (attractorPosition - _particles [i].position) / (_particles [i].lifetime) * Time.deltaTime;
             }
             _particleSystem.SetParticles (_particles, length);
         }
 
     }
 }
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 _kotsos_333 · Jul 08, 2015 at 09:08 AM 0
Share

Works for me with a few changes...Thank you!!

avatar image Mischa · Jul 15, 2015 at 10:00 AM 1
Share

would be cool if you could accept the answer then ;-)

avatar image silentreaver · Sep 11, 2017 at 11:01 AM 1
Share

If this isn't working for you, make sure you set the particle system simulation space to "World"

avatar image Ex6tra · Dec 03, 2020 at 09:55 PM 0
Share

Thank you so much!

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

6 People are following this question.

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

Related Questions

particle systems' physics heavily depends on framerate?? 1 Answer

Change particle bounce relative to the speed of the GameObject colliding with them? 1 Answer

Can Particle System ignore a given collider? 3 Answers

Particle collisions without physics force 1 Answer

How to change a simple snow particle FX to generate a speed effect? 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