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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Glitch in Particle system when "inherit velocity" and world space are enabled

Discussion in 'Editor & General Support' started by Layer8, May 22, 2015.

  1. Layer8

    Layer8

    Joined:
    May 22, 2015
    Posts:
    2
    Glitch.png
    So, I'm working on a space ship game, and the particle system looks to make a great "machine gun" but I've noticed some weird effects from the particle system. If I stand still, I can fire the gun and everything works fine. But if I fire the "gun" while I'm moving, some of the particles "freak out" and bunch together and go at a really slow speed. I've read other posts about changing the rigidbody to "interpolate" and that didn't help, I've also seen other posts about making sure that any force being added to the rigidbody needs to be done under "FixedUpdate()" and I'm already doing that, yet I still end up with stray particles that bunch up. Any ideas on how to correct this? And forgive me, I'm not sure what information you'll need to help, and I figured posting the ENTIRE code wasn't a prudent move, so, again, thank you for your time and help.

    BTW, the "machine guns" are 3 separate particle systems attached as children to the player's game object. They are "activated" by the mouse button during a Input.GetButtonDown which activates the particle emitter via .enableEmission = true call for the individual particle systems. I call enableEmission = false when Input.GetButtonUp is called. Both GetButtonDown & GetButtonUp are checked during the regular Update() function. I'm using the GetButtonUp/Down so I'm not activating / deactivating the particle systems each frame.

    I don't know if this would classify as a bug, or if I'm just doing something stupid. But I've been wracking my brain on this and searching both the forums and google for the last hour with no success. Any help would be appreciated.

    Roger
     
  2. pmurph03

    pmurph03

    Joined:
    Mar 17, 2014
    Posts:
    51
    It's hard to tell from the static image if they are actually going slower than the other particles as you are firing them as you are moving. Were all of those particles fired while you were moving at max speed? I'm not 100% sure how inherent velocity works, but if your ship is moving at a certain speed and the particles are emitted with a set velocity that is close to the ship speed they would not contain the speed of the ship plus the velocity they are supposed to start at, and would appear to go slower and bunch up due to the ships velocity being close to the particles initial velocity.
     
  3. Layer8

    Layer8

    Joined:
    May 22, 2015
    Posts:
    2
    Yeah, I'm sorry. Those particles were all fired while the ship was at max speed. They also fired off at a different angle than the ship was traveling. Basically, the ship was moving, I had held down the thrust button as well as the "fire" button. What SHOULD be a result is a steady stream of particles moving directly forward of the ship. I've uploaded a web player version to my test server. You can see the action here. Go any direction, and while holding down forward (W) press and hold the fire button (Left mouse button) and you'll notice randomly glitches where they'll fire different directions (slightly) or they'll bunch up, or several other things other than a steady stream of particles.

    http://test.layer8software.com/test.html
     
  4. Undertaker-Infinity

    Undertaker-Infinity

    Joined:
    May 2, 2014
    Posts:
    112
    I tried it. This is physically correct behavior.
    The ship gains speed comparable to the bullets and acceleration is really high, so essentialy the ship is "catching up" to the bullets.
    Increase your bullet speed or decrease ship acceleration.
    OR you could set inherit speed to 0 and have your max ship speed be always inferior (much, much inferior) to the bullet speed. Do you really want to be able to change the bullet's speed?

    Oops, this post is old. Oh well.