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
  4. Dismiss Notice

Shuriken - inherit velocity doesn't work properly!

Discussion in 'Editor & General Support' started by Kubold, Nov 22, 2012.

  1. Kubold

    Kubold

    Joined:
    May 10, 2012
    Posts:
    358
    I have a Player character that is moved by adding forces to it's rigid body. I made sort of a flamethrower using particles from Unity 3.5 (not shuriken). I took a velocity vector from the player character every frame, and set the world velocity of the particles every frame. This way if the character is moving 100km/h forward, the particles don't stay behind him (even if in the real world they would ;)).

    Right now I switched to Unity 4, and I'm trying to redo the flamethrower using shuriken. It is a better system in every way, except using "Inherit velocity" produces very strange and random results. Literally, the particles go in random directions when I change velocities of the player with controls. Instead of adding the player's world velocity to their local velocities they go crazy whenever I press a direction button.

    I mean, most of the time they go in proper direction with proper velocity (inherited from player), but when I change the veloctiy with controls, 20% (more less) or sometimes all particles for 0,3-1s go in random direction. Mostly in world Z axis, but sometimes in X or Y.

    Is that a bug?
     
  2. Kubold

    Kubold

    Joined:
    May 10, 2012
    Posts:
    358
    Ok, no help. I tried everything, it's a bug. Well, switching back to old particle system... Looks a little bit worse, has no collisions, but it works.
     
  3. Switchice

    Switchice

    Joined:
    Nov 24, 2012
    Posts:
    7
    I'm experiencing something quite similar.

    I'm building an exhaust-flame from a spaceship with the Shuriken particle system. What I want to a achieve is that nice kind of bend in the flame when you turn. To do this the smoke and fire need to inherit the velocity of the craft. Else the flame will make a sharp angle, as opposed to the wanted bend, right at the engine exhaust.

    It's just that the inherit velocity doesn't work properly. When I turn it on most particles will go the right way, backward, but a whole lot will be sent out in front of the craft or to the sides (when turning). The effect is worse at higher velocities.

    I took a picture of the problem:


    I use rigidbody and add forces to power the craft, could that cause such problems?
     
  4. proandrius

    proandrius

    Unity Technologies

    Joined:
    Dec 4, 2012
    Posts:
    544
    Hey guys, can you please create a bug report with reproducible project and send me PM a case number. Thank you! :)
     
  5. Switchice

    Switchice

    Joined:
    Nov 24, 2012
    Posts:
    7
    Who are you? Are you support, and if so why do you only have one post?
    If you are support then please tell me what you mean with a bug report? I thought I just wrote one here!
     
  6. proandrius

    proandrius

    Unity Technologies

    Joined:
    Dec 4, 2012
    Posts:
    544
    Hi, sorry this is my new account for the forum. I had to change for some reasons. I'm QA at Unity.

    It would be nice if you could create a bug report from Unity Help->Report a Bug with your a project where I can reproduce this issue.
     
  7. Switchice

    Switchice

    Joined:
    Nov 24, 2012
    Posts:
    7
    A report has been submitted, hopefully the problem will be solved one way or another :)
     
  8. Switchice

    Switchice

    Joined:
    Nov 24, 2012
    Posts:
    7
    I was wondering if my reply to bugs@unity3d.com came forward? It looks like the kind of mail you might not be able to send a reply to?
     
  9. Switchice

    Switchice

    Joined:
    Nov 24, 2012
    Posts:
    7
    Bump, I lost contact after the first reply from support. I really would like someone to answer :)
     
  10. Switchice

    Switchice

    Joined:
    Nov 24, 2012
    Posts:
    7
  11. PrimeAlly

    PrimeAlly

    Joined:
    Jan 2, 2013
    Posts:
    35
    I have exactly the same problem as Switchice. I am also building a spaceship and cannot get Inherit Velocity to work correctly.
    At low speeds the particle system looks ok (not as good as in local simulation space, but ok). At higher speeds it looks really strange and also emits in the wrong direction.

     
  12. GallopingGames

    GallopingGames

    Joined:
    Mar 13, 2013
    Posts:
    26
    I'm having the exact same trouble with the latest build (Unity 4.1.1f4) Causing me real problems with spray from a boat puffing in the opposite wrong direction at regular intervals just like Lorodion's picture. I wonder if this is a new problem or has always been there?
     
  13. userTrav

    userTrav

    Joined:
    Jun 28, 2013
    Posts:
    37
    Seems to be still a problem in Unity 4.1.5f1, bug report submitted.
     
  14. PrimeAlly

    PrimeAlly

    Joined:
    Jan 2, 2013
    Posts:
    35
    This has not been fixed yet as of version 4.3.0f4.
    I have also sent a bug report to Unity so that they can fix this!

    If anyone else wants to reproduce this, download my project from here: View attachment $unityShurikenBug.zip
    Zoom/pan with the mouse, wait for a few seconds and you'll see the error appear.
     
  15. PrimeAlly

    PrimeAlly

    Joined:
    Jan 2, 2013
    Posts:
    35
  16. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    628
    This issue still exists in 4.3.3

    Also trying to do a spaceship thruster effect, and when I enable the effect, the first few particles emit with a completely wrong velocity. Then the effect behaves until I stop it and restart it - where it does the same thing
     
  17. BrennanP

    BrennanP

    Joined:
    Mar 22, 2014
    Posts:
    1
    Has this really been a bug for a year and a half? It makes the particle system almost useless on any moving object. And there's no way to access most of the particle system via script? I could make this work if I could just set the initial velocity each frame in the script.
     
  18. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    628
    Still not fixed in 4.5 :(
     
  19. pelikan13

    pelikan13

    Joined:
    Feb 20, 2010
    Posts:
    7
    Are there any news on this bug? i'm having the same problems when trying to create tyre smoke for cars, most particles will behave as expected but a few will shoot ahead of the car. As other have noted the problem is more notable at high speeds.
     
  20. joachimbarrum

    joachimbarrum

    Joined:
    Jun 24, 2014
    Posts:
    2
    Is there any progress on this bug ? I saw you wrote in another thread, inherit velocity at 1 should make the particle stick to the parent 100%. Currenty thats not how the inherit velocity works at all. It you put it to inherit velocity 1, the particle will fly off in all kinds of directions, depending on the speed you move. So, essentially you cant really do anything decent with inherit velocity right now. The only thing you can achieve right now is some movement to the world particles on a low value, but you don't really have any decent control over it. This bug has been existing now ever since Shuriken was released, and currently you cannot make any particle behvave like a tail or something similar to that. It's either world velocity where its stuck in the emitting space (with its local movement added) or its local and completely linked. So theres a lot of situations you have to find a certain workaround and never get the result you are aiming for.

    Anyone found any workaround for this I would be very interested to hear. But most of all I wish Unity could fix this bug soon! I'm experiencing situations this is needed frequently.
     
  21. Aurore

    Aurore

    Director of Real-Time Learning Unity Technologies

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    Could you post your bug numbers here so I can check to see what's happening.
     
  22. Griautis

    Griautis

    AI & Physics STE Unity Technologies

    Joined:
    Jan 26, 2013
    Posts:
    63
    As Aurore said, please post the bug numbers, so we can look at them as soon as possible.
     
  23. MarkN

    MarkN

    Joined:
    Sep 24, 2013
    Posts:
    10
    I'm also having this problem and it's getting urgent for me. I have just submitted a bug myself - #619852 :

    http://fogbugz.unity3d.com/default.asp?619852_46r7kule36neuqa6

    The issue seems to occur when I call Play on the ParticleSystem after all existing particles from the last burst have expired - the first new particle released will often shoot off at an odd angle. If I set Inherit Velocity to 0 it fixes the issue completely, but any other value causes the glitch.
     
  24. [DR] Abbot

    [DR] Abbot

    Joined:
    May 12, 2013
    Posts:
    1
    Any news here? Trying to decide if I should try to hack together a workaround.
     
  25. Griautis

    Griautis

    AI & Physics STE Unity Technologies

    Joined:
    Jan 26, 2013
    Posts:
    63
    Hey,

    Well, the bug went to the developers, however depending on your own timeframe you might benefit from hacking something.

    Best wishes,
    Ugnius
    Unity QA Team
     
  26. FreebordMAD

    FreebordMAD

    Joined:
    Mar 15, 2013
    Posts:
    633
    I have found a work around for this! AFTER ALMOST ONE YEAR :(!
    The problem seems to be that no changes to a Rigidbody or a GameObject are allowed to be done in the Update method or in a couroutine with WaitForEndOfFrame (or timed). Now when I use Rigidbodies I handle all forces in FixedUpdate and in coroutines with WaitForFixedUpdate and now everything works fine. If I have to move objects without a Rigidbody attached I do this in a coroutine after WaitForFixedUpdate (I simulate my own Update ).
     
  27. Karwoch

    Karwoch

    Joined:
    Sep 16, 2014
    Posts:
    111
    Damn, Unity 5.1 and still nothing, this bug is known for more than 3 years! It seems it won`t be resolved than :( And unfortunately fixed update doesn`t resolve this one for me... My missiles will be looking bad. Bad Unity engineers, bad! ;)
     
  28. Karwoch

    Karwoch

    Joined:
    Sep 16, 2014
    Posts:
    111
  29. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,846
    Hey!

    Just wanted to give you an update on this ;)
    So the issue is caused by the way we calculate the initial velocity in our particle system and how its calculated in the physics system. They both have slightly different values which become more noticeable as things get faster.
    We are now working on a fix for this, but for the moment if you use physics to move an object at high speed then you may have this issue.
    We also noticed that some of the reported issues are also suffering from floating point imprecision, this is going to happen when you move far from the origin so be aware of this as it may be the real issue for some of you :D

    Edit:
    So the fix is actually really simple. Just enable interpolation on the rigidbody. :rolleyes:
     
    Last edited: Aug 3, 2015
    bakspace and FreebordMAD like this.
  30. summerian

    summerian

    Joined:
    Jul 6, 2014
    Posts:
    140
    I'm thinking I have the same problem in Unity 5.1.2f1.
    I have tried enabling interpolation on the parent object, put everything in fixedupdate, inherit velocity = 1.
    When I use forces to move my parent object around I looks like the particle system is turning left/right before it's parent, which it is a child of. If I set simulation space to local the particles are emitted from the correct location but then it's kinda useless.

    I wanted to vote on the issue but apparently it has been marked as fixed?
     
  31. Karwoch

    Karwoch

    Joined:
    Sep 16, 2014
    Posts:
    111
    Also for me interpolation did nothing unfortunalty.
     
  32. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,846
    If you still have problems consider opening a new bug report. All of the issues for this report were solved with interpolation so voting on it would not help. We need a repro that still has problems with interpolation.
     
  33. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,846
    I am looking at the issue at the moment. Its a tricky one but I have a few ideas for a solution.
    We could just use the velocity from the RigidBody however that introduces new problems. A lot of systems use particles with animations under a RigidBody so only taking the rb velocity would negate any local velocity. We need to accumulate the RigidBody velocity with a local velocity value....so that's my current plan. Now lets see how it goes ;)
     
  34. PrimeAlly

    PrimeAlly

    Joined:
    Jan 2, 2013
    Posts:
    35
    Funny thing to come back to Unity after 4½ years and STILL encounter this problem. @karl_jones anyone worked on this in the last year?
     
  35. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,846
    I fixed this. If a particle system has a rigid body it uses the velocity value from that instead. We also have an option to select where you want the velocity to come from(in a future version 2017.2~).
    What version are you still having the problem in? What is the problem you are seeing? Is it high speeds or something else?
     
    FreebordMAD likes this.
  36. PrimeAlly

    PrimeAlly

    Joined:
    Jan 2, 2013
    Posts:
    35
    I've created a test scene to reproduce this. It contains a simple cube with a particle system (thruster) and constant acceleration in positive x. I added a "safe zone" script to loop the box within -1000 >= x >= 1000 to avoid floating point issues. There's also a script for the camera (to look at the cube) and a script to log the cube's velocity periodically.

    This is what it looks like at start:


    And this is what it looks like after some time (high velocity):


    You can download the project here.
    Just press play and you can see the action. At about a 100 units per second (velocity) you can see the thruster particles jumping out ahead of the cube and the full thruster system also jumps around violently.
    Another thing is that the particle system gets elongated as time passes which is not realistic for particles that inherit the speed of an object with constant acceleration on a linear path.

    Maybe I configured something wrong - if you got any suggestions on how to fix this @karl_jones let me know!
     
  37. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,846
    I took a look at the project. The particle system is now using the RigidBody velocity and you can see the difference when turning this on/off(I think you need 2017.2 for this). However there is going to be some creeping inaccuracy due to all the different delta times(Fixed update and per frame). If you pause and step through per frame then its perfect as those inaccuracies are removed.

    There are a few ways to improve this.
    1. Enable interpolation on the RigidBody.
    2. Use a lower FixedUpdate value in the TimeManager, this means Physics will be updated more often so could cause performance issues if you have a lot of physics however it will also make your physics more accurate. For me this fixed the issue.
    3. Dont go soo fast :p
     
  38. majlo

    majlo

    Joined:
    Jun 15, 2015
    Posts:
    7
    Hi.
    Got another issue.

    What happened with inherit velocity set to "current"? It worked I think in 5.5. I'am on 5.6.1f1 right now and setting inherit velocity to current does not work no matter the multiplier value. Initial works fine. Both emitters simulation space is set to world.

    Is there any new trick to make it work? Documentation did not change a bit.
     
  39. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,846
    Can you file a bug report please
     
  40. majlo

    majlo

    Joined:
    Jun 15, 2015
    Posts:
    7
    Sure thing.
    Case no. 934429
     
    Joshdbb and karl_jones like this.
  41. Fiard

    Fiard

    Joined:
    May 15, 2013
    Posts:
    4
    This problem still exists in 2019.4.21f1 if you set mode initial for inherit velocity ... Very sad ...
     
  42. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,846
    It's not a bug.
    Inherit velocity is applied to the particles at when they spawn. Once they are emitted it does not affect them.
    If you have particles spawning at birth you may find this as the velocity can be 0 at this point.
    Adding a little delay to the sub emitter burst or inheriting at another time (on death, for example) would pick up some velocity from the parent and then they can do some inheritance from it.
    We also have an API to set the velocity of the system directly so you have more control of the internal velocity being used used. https://docs.unity3d.com/2021.2/Doc...articleSystem.MainModule-emitterVelocity.html
     
    Last edited: Jul 13, 2021