Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Need help with particle system rotation

Discussion in '2D' started by Danniboy12344, Aug 6, 2023.

  1. Danniboy12344

    Danniboy12344

    Joined:
    Jul 14, 2021
    Posts:
    3
    I have a flamethrower in my game using a particle system. Here's the video:
    https://clipchamp.com/watch/QONwolloHdi

    As you can see, the flames will rotate with the player, however I only want it to rotate the spawning of the flames, but the existing flames still rotate. Anyone got any suggestions in how I can solve this? Thanks!

    Here's the script I use if it helps:
    Code (CSharp):
    1.     public GameObject flameThrower;
    2.     private ParticleSystem loopableFlame;
    3.  
    4.     public Player player;
    5.     private bool throwing = false;
    6.     // Start is called before the first frame update
    7.     void Awake()
    8.     {
    9.         loopableFlame = flameThrower.GetComponent<ParticleSystem>();
    10.         loopableFlame.Stop();
    11.  
    12.     }
    13.  
    14.     // Update is called once per frame
    15.     void Update()
    16.     {
    17.         if (Input.GetMouseButton(0))
    18.         {
    19.             if (!throwing)
    20.             {
    21.                 throwing = true;
    22.                 loopableFlame.Play();
    23.             }
    24.             player.canMove = false;
    25.         }
    26.         else
    27.         {
    28.             throwing = false;
    29.             loopableFlame.Stop();
    30.             player.canMove = true;
    31.         }
    32.     }
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,560
    Change the simulation space to local, not world.

    Then go forth and set lots of things on fire. :)
     
  3. Danniboy12344

    Danniboy12344

    Joined:
    Jul 14, 2021
    Posts:
    3
    Kind of works, but then all then all flames will move as you rotate in a line. I might try to instead of using a child object, instantiate a non-loop prefab a ton of times so the flames won't rotate with the player and see if that works. Once I get back on.