Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  5. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

[Feedback] New External Forces Module

Discussion in 'Particle System Previews' started by richardkettlewell, Jan 16, 2018.

  1. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    810
    karl_jones likes this.
  2. ifurkend

    ifurkend

    Joined:
    Sep 4, 2012
    Posts:
    339
    Thanks for adding this new toy. My first-hand UX is that the Force Field (FF) component should provide a gizmo in scene view which allows us to view the FF outline even when the FF object isn't currently selected in the hierarchy.

    Simultaneously allowing both Influence Mask and Explicit List leads to some confusing situation, for example when there are 2 FF objects potentially affect the Particle System:
    Case A: Influence Mask: Everything; Only 1 FF assigned.
    Result A: Both FFs in effect.

    Case B: Influence Mask: Layer 1; Only FF of layer 2 assigned.
    Result B: Only FF of layer 2 in effect.

    I can see the good intention here, but I don't think we need this complicated filtering. I prefer a switch between the influence mask and explicit list (much like switching between emission rate over time/distance in older Unity), even though in most case I believe the list is a more rational choice for the sake of performance.
     
    Last edited: Jan 16, 2018
    dadude123 and karl_jones like this.
  3. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    - Gravity Focus is a really cool addition that I found really useful for a few specific effects.

    - Rotation + Rotation randomness is really awesome. I didn't know I needed that until now :)

    - Can you explain the "Attaction" property? It seems to be somewhat broken for me, shooting off particles extremely fast, so far that I get red errors about IsNaN and stuff being outside some AABB.
    Only stable values seem to be around 0.1, everything else is erratic.
    Is it how strongly the particles are affected by the rotational influence?
    It feels like whatever it is, it should be limited to 0-1 maybe?

    - I see the rotation axis is simply the local up of the force field and doesn't have its own setting, which is nice.

    - Bug: A Cylinder type force field will apply Rotation in a sphere region instead. (using rotation randomness as well)

    - I like the list of forcefields that affect a given particle system, and the influence mask is nice for some "global" effects if you want to affect a lot of systems and don't want to collect all of the forcefields and particle systems.
    Not sure what to think about the potential performance problems though. Are there checks to make sure that no calculations are done when the forcefield bounding box doesn't overlap the bb of the particle system?

    - I would really like to see the ability to have the Noise module directly inside a force field instead of controlling the noise module intensity of the particle effect itself. For example some global wind effect you would have to make sure every particle system uses the same noise settings which is bad and maybe you don't even want that.


    Overall I really like the force fields!
    Will there be a Donut force field as well eventually?


    Also, any plans to add smoothing to trails?
    It's a recurring problem for me. Some kind of spline smoothing would be great if that is even possible (it would likely distort previous path segments and be extremely resource intensive, but maybe you have a better idea). The point is to reduce this: https://i.imgur.com/7M0uSnZ.png
    (In some effects much more pronounced)
     
    richardkettlewell likes this.
  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    810
    Thanks for the comprehensive feedback so far!

    It's how strongly the force field "sucks" particles into the vortex (spinning) motion. you're right that it should be 0-1 (we haven't implemented any clamping of valid ranges in the UI yet). The tooltip should have explained this field clearly, so, please take a look, and if you think the tooltip could be improved, let us know and we can look at rewording it!

    Thanks - noted on our QA doc to be fixed.

    Yes there are - an entire force field is skipped if its bounding box doesn't touch the bounding box of the particle system :)

    A follow-up question: Do you like being able to use both at the same time? Another user suggested we should limit the UI to choose one or the other, for a simpler, more intuitive UI.

    The noise is quite expensive to calculate, so it was thought to be more efficient to compute it once, and then simply apply a multiplier to the result, within each force field. Plus it has a lot of UI options. we were going to expose multipliers for the other modules too (eg Force over Lifetime, etc). But I do appreciate your point that configuring noise per force field would be powerful. We will consider what to do here.. :)

    We hadn't planned on it.. I was thinking about adding a Box, but not a Donut. Is it useful? I guess it must be, if you're suggesting it.. I will add it to our QA list too :)

    No, we haven't got any immediate plans for trail smoothing. We are aware of the problem you're describing though.. it's quite tricky to solve robustly :(

    You're right - we have made a note to implement this. We imagine it would be very similar to the Shape Module, where the shapes appear in the Scene View when you unroll the Module Inspector.
     
  5. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    Well, there is a tooltip. https://i.imgur.com/iUAZrDs.png
    Could be worded something like: Controls how strongly particles are dragged into the vortex motion. A value of 1 will ensure they cannot escape (maybe?).

    Also in my experience it is always neccesary to add at least a little gravity (~0.1) so the particles don't escape the vortex.
    If that is normal then everything is fine, the exact sphere in which particles swirl around can be tuned nicely through the gravity focus.

    I have recorded a video that shows how unreliably the attraction property is though.
    Maybe probably using it wrong, or in a configuration where other things interfere with it.
    It also shows another bug at the end when I change the outer radius.

    > https://streamable.com/ex7yx

    I don't like to use both at the same time, it only makes things more complicated.
    Personally I would like to use force fields for small things like wind, or explosions that blow particles and flames, ... because they might be really hard to "collect" (hard as in would probably take too many cpu cylcles to find all those nested and hidden particle systems that are tucked away god knows where: as children of animated bones of some characters hand/weapon, ... ).

    If I want more control over a specific particle system or set of them, then I'll most likely use scripting to set the lists.
    I don't think it makes sense to use both at the same time.
    Maybe there is some rare scenario, but I don't see it yet.
    In my opinion, either you use layers or you set lists, but both at the same time just makes things harder to keep track of and debug.

    As for the UI: If you go with the "only one thing" approach then it would certainly make sense to only show one at a time. Personally I have no use for both control mechanism at the same time.


    That request was mostly because the cylinder didn't work as expected.
    It would however be nice to have a shape where particles coil around a circular path.

    A Box though? I was under the impression that force fields need at least one symmetry axis.
    But a box could definitely be useful to do linear effects.
    But there's no linear velocity in the force field yet, the particle system has it; so combined with a box it would make sense.
     
  6. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    810
    Haha, yes, I'd noticed that too... I think someone on our Editor team has a bug to fix! ;)

    I've made a note to discuss this with some other folks, thanks!

    Yeah we've noticed that too. I suspect its due to the approximation of moving around a circle, that we perform each frame (meaning particles always travel in a straight line for a given frame, so they perhaps drift out of the circle slowly.) Maybe we can tweak the maths to prevent this.

    Thanks again for the feedback!
     
    dadude123 likes this.
  7. ifurkend

    ifurkend

    Joined:
    Sep 4, 2012
    Posts:
    339
    Yeah, it will be helpful this way for the consistent usage pattern.
     
  8. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    Hello again,
    I just wanted to ask if the external forces module is planned to be released as part of the 2018.1 main release.
    For 2017.3 which I'm using at the moment, I wrote my own (more simple) script to use in the meantime while the module is not yet officially released.

    I wasn't really sure at first what to do with it but now I got quite a few use cases for it.
    Guiding particles along a set path for environment effects...
    or even more complex stuff like adding effectors to certain objects, so they push dust motes in the air out of the way by scripting rotating the force field so it is aligned with the motion of the object (if it gets thrown around the force field will push particles forwards but not backwards, which is nice)

    And its also cool for fires that have some heat flow upwards and affect the environment effects around.

    I wanted to ask if it would be possible to make it so the effect gets stronger towards the center, maybe using a bool setting to turn that on/off for each force field. Or maybe even a curve "distance-vs-effect-strength" because a simple linear scale from edge to center might be too simple. A curve ("AnimationCurve") is needed to map distance to strength, so we can control at what point the volume will have its maximum strength/effect on the particles.

    For spheres a simple distance to the center, and for a torus/donut distance to the closest point on the "central ring". For a cylinder distance to the axis...

    Also it would be cool to be able to override the color of a particle as it enters the volume (strength of the color change also based on distance to the center of the volume).
     
    Last edited: Jan 22, 2018
  9. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    810
    Definitely not - once a release goes into public Beta, we try to be strict about not adding any new features to it.

    We already did this in the current prototype :)

    Many of the properties use MinMaxCurves, similar to what we use in the main Particle System UI. Take a look a little dropdown arrow next to many of the properties in the Force Field Component. If you switch any of these options to a Curve, you can control the strength of the parameter based on how close a particle is to the center/edge of the field. Random between 2 Constants is also very useful for making each particle have a small amount of variation within the field.

    Cool idea :)
     
    dadude123 likes this.
  10. ClayChi

    ClayChi

    Joined:
    Mar 30, 2018
    Posts:
    6
    Hello, this is a cool project, looking forward for another release that parameters of the force field component are exposed via API. As far as I know only few parameters are available in API.

    Also for feature request, I like to see mesh object being used as shape type if possible. And I guess it will need a center point or maybe not, so empty gameobject position can be used as center point.

    I also think this features should have been developed way long ago!
    Thanks.
     
  11. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    700
    Any progress on this?
     
  12. ClayChi

    ClayChi

    Joined:
    Mar 30, 2018
    Posts:
    6
    Can we get status update on this? have you stopped working on this or will it be canceled or planned to be released on some date?
     
  13. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    3,091
    Hi. Yeah we are still working on it. It's ready, just going through QA. We are hoping for a 2018.3 release but no guarantees,. depends on how things go with QA. We actually presented it at Unite Asia and will also be showing it at Unite Berlin.
     
    Last edited: May 30, 2018
    ClayChi likes this.
  14. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    810
    We can finally confirm that this is confirmed for official release in Unity2018.3! Thanks for the feedback everyone!
     
  15. ClayChi

    ClayChi

    Joined:
    Mar 30, 2018
    Posts:
    6
    Really nice to have this in 2018.3 but will all the fields of the forces will be scriptable and exposed in API, since many of the variables were missing in last release.
    Thanks!
     
  16. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    810
    Yes we added them just before pushing the feature to 2018.3 :) (and they work with animation too!)

    Credit to @karl_jones for getting those curves working in script outside the particle modules!
     
    karl_jones likes this.
  17. Phynal

    Phynal

    Joined:
    May 26, 2015
    Posts:
    1
    I was working in 2018.3.0b10 this past weekend and I found that the
    ParticleSystem.ExternalForces
    module exposes the setting for the influence mode (Layers or List) in code, but it *does not* expose the list itself for reading or editing. Is getting/setting the list via code going to be allowed?

    In my case from this weekend I had a script that would spawn N copies of an object. Each object had 2 force fields and a particle system on it. When an object (A) got within range of another object (B), I wanted A's force fields to affect B's particles without B's force fields affecting B's own particles. If during this, however, B was in range of another object (C), then I needed B's force fields affecting C's particles but *not* B's particles. Also, in this scenario, if A was out of range of C, I didn't want C's particles to be acted upon by A's force fields (even if A's fields were in range of where B's fields moved C's particles).

    My plan had been to access the list in the ExternalForces module via code and dynamically add or remove force fields from the list as necessary, but without that list being exposed I was unable to come to a solution that could do what I wanted. I also had too many objects and potential interactions to use any layer based solution that I came up with, which is why I needed to use the list in the first place.
     
    Bromm likes this.
  18. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    3,091
    Hey. Probably just an oversight on our part. There's no technical reason it's not exposed. I'll look at getting it added.
     
    Bromm and richardkettlewell like this.
  19. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    3,091
    The missing script api is now in 2018.3, it will be in 2018.3.0f1!
     
    Bromm and richardkettlewell like this.