Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Make Particles aware of gravity change: HOW?

Discussion in 'General Graphics' started by Deeeds, Sep 27, 2018.

  1. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    I'm (ab)using the Gravity Modifier in a few particle systems and just discovered they're ignorant of changes to gravity.

    How do I "reset" just this setting, without reactivating or otherwise interrupting a running particle system?
     
    InfinitePowerSeries likes this.
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,366
    Changing gravity at run time works perfectly fine, however I wonder if your expectations for what should happen is the problem.

    For example, if you have a gravity value of 1, then change it to 0, that won't mean particles that have already spawned stop moving down, they only stop accelerating down. If you're looking to have particles suddenly stop moving you may need to modify the particle velocities directly with GetParticles/SetParticles, or abuse the limit velocity module.
     
    InfinitePowerSeries likes this.
  3. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739

    As per the original post, I'm changing gravity during play.

    Neither of your comments/suggestions are pertinent to this problem.
     
    InfinitePowerSeries likes this.
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,366
    Are you changing the Physics.gravity and not seeing it apply to particles? If so, that wasn't clear from your original post.

    If that's the problem, then it's likely a bug. You might be able to work around this using Particle Force Fields or modifying Force Over Time on each system.
     
    InfinitePowerSeries likes this.
  5. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    Yes. Changing gravity and seeing no changes.

    The problem: I'm using 2D physics.

    Particles, regardless of all other settings, seem to be calculated in response to 3D physics when using the Gravity Multiplier.

    I'd have thought, given that I've explicitly set to use 2D physics for collisions, that it'd also be using the 2D physics gravity... but no...
     
    InfinitePowerSeries likes this.
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,366
    So then, you are specifically changing Physics2D.gravity and not seeing a change? Have you tried changing Physics.gravity to see if it does anything, or just Physics2D.gravity?

    Either way, I’d still say it’s a bug and I’d report it to Unity with a simple test scene.
     
    InfinitePowerSeries likes this.
  7. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    Yes, I've found the problem. It's that particles are always responding to 3D physics gravity. Not 2D's gravity.
     
    InfinitePowerSeries likes this.