Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Particle System Inherit Velocity Changes: Your feedback needed!

Discussion in 'General Graphics' started by karl_jones, Jun 15, 2016.

?

Should the particle system use a RigidBody's velocity( if one is available)?

  1. Yes

    72.2%
  2. No

    0 vote(s)
    0.0%
  3. Provide an option(Post a reason why!)

    27.8%
  1. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,142
    Hey!

    A bit of background
    We are currently investigating a long standing issue regarding the particle system and physics.
    When a particle system is driven by a rigidbody and is using inherit velocity the particles will behave erratically when the system is moving at high speeds.

    This is because we calculate the particle systems velocity each frame by using the old position, new position and time dt:
    Velocity = (position - oldPosition) / dt;

    The rigid body does not update every frame(it uses fixed time) so our velocity calculation can be off from the actual velocity used by the rigid body.

    Currently we suggest users enable interpolation when using RigidBody's to fix this issue and it does work in the majority of cases however if you are setting the velocity directly to the rigidbody then the velocity calculations can become incorrect.


    For example.
    If a system is moving along the x axis and a script changes the velocity to now be along the y axis then we get a frame where our velocity is calculated incorrectly causing a particle to fly off in the wrong direction.
    upload_2016-6-15_17-16-52.png

    example.gif

    The fix
    We now have a fix which does the following:
    Velocity = rigidbody velocity + local velocity.

    Local velocity is calculated from the coordinates with respect to the rigidbody. So for example if you had a child particle system moving under a rigid body parent then you would want the velocity of the rigid body plus the velocity of the local movement.

    The question
    So now you have some background :D
    We want to make it default behaviour to grab the rigidbody velocity and do the above calculations if a rigidbody is present. We discussed internally having an option to enable/disable this behaviour but could not see any reason you would not want it enabled. We don't want to add unnecessary API/editor features.

    So can you see any reason why you would not want this enabled by default?

    Edit:

    This fix has now gone into 5.5. If you have any issues regarding this please file a bug report and post the number here.
     
    Last edited: Jun 24, 2016
    levlaj likes this.
  2. BenMora

    BenMora

    Joined:
    Jul 6, 2021
    Posts:
    5
    Here in 2022 trying to figure out why "Inherit Velocity" doesn't work. The ParticleSystem component is on a GameObject that doesn't have a RigidBody, and is moved around via scripts. It behaves so erratically that I'm not sure I could even describe what I think is happening. It seems like SOME but not all of the particles are at least inheriting the direction but not magnitude of the parent transform's velocity. Ie, some of the particles shoot foward faster than the object when it starts moving forward.
     
    DanjelRicci likes this.
  3. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    308
    I always experienced this issue with the Inherit Velocity module since I recall working with particles, in fact I never use it. Most of the particles will correctly inherit it, but a bunch of them will just shoot away very fast in a random direction. How is this not fixed yet? Is there even a workaround we can use?
     
    benthroop likes this.