Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Interactive Particles using Shuriken

Discussion in 'Scripting' started by Mr Turnip Head, Jul 13, 2012.

  1. Mr Turnip Head

    Mr Turnip Head

    Joined:
    Feb 9, 2010
    Posts:
    34
    Is it possible to create interactive particles within Unity and if so how would I script it?

    What I would like to be able to do is where the user touches the screen a small radial force moves the particles.

    Unfortunately I have no scripting experience and just can't follow the scripting reference pages to see where to start looking, and google searches haven't helped so far.

    Thanks
     
  2. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    4,865
    Vibre (see sig) is (mostly) a particle systems, you can do quite a bit.

    Its not clear exactly what you need, you may be able to just use Play() and Pause() to control your particle system, or you may need to manipulate particle systems directly. Take a look at GetParticles() and SetParticles() for a start.
     
  3. Mr Turnip Head

    Mr Turnip Head

    Joined:
    Feb 9, 2010
    Posts:
    34
    Thanks for the reply. Had a play of your game and enjoyed it. Will also take a look at GetParticles() and SetParticles()

    I should explain a little more clearly what I am trying to achieve.

    I am looking to create a game menu that has a particle system in the background, currently small stars slowly floating around. I want to be able to let the player tap the screen and in that location create a small radial force that will move any local stars away. So it's not creating any new particles, just affecting the ones currently on the screen.
     
  4. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    4,865
    You can do that with get and set. You can manually move particles, control their size, colour, etc.

    Really only a few steps for a basic implementation...
    1. GetParticles
    2. Loop through particles
    3. If particles near finger adjust velocity
    4. SetParticles

    If the velocity adjustment doesn't give you enough control you may want to store the "near particles" and move them manually.
     
  5. Mr Turnip Head

    Mr Turnip Head

    Joined:
    Feb 9, 2010
    Posts:
    34
    Good to know that it sounds like it's possible to do. However I know nothing about scripting and don't really know where to start trying to implement it. Will have a go over the weekend if I get a chance.

    Thanks
     
  6. Mr Turnip Head

    Mr Turnip Head

    Joined:
    Feb 9, 2010
    Posts:
    34
    I have spent an evening trying to see if I can get anything like this to work but I just don't have the scripting knowledge to even know where to start. Is there anything I could read that is going to help me?
     
  7. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    4,865
    Do you have a specific question? Maybe post some code.
     
  8. Mr Turnip Head

    Mr Turnip Head

    Joined:
    Feb 9, 2010
    Posts:
    34
    Thanks for trying to help, but I think I am just out of my depth on this one for now. I have no code to post as I just don't know where to start.

    I am going to try going with a simpler effect that has no user interaction for now.
     
unityunity