Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[2019.2.0f1][Bug] Cloth component seems to not work properly in some situations

Discussion in 'Editor & General Support' started by SupraLP, Aug 11, 2019.

  1. SupraLP

    SupraLP

    Joined:
    Apr 12, 2018
    Posts:
    5
    i am creating content for an upcoming game and i have made a custom humanoid model in blender, that i exported as an FBX and imported into unity then. until now i was able to use cloth on that models skirt. But after upgrading to 2019.2 setting up cloth is wierd and its gravity is reversed. Sometimes it freaks out completely... For testing i have put cloth on a plane and that worked without any issues. I don't know, why cloth acts so wierd on my custom mesh. on 2019.1.10f1, 2017.4.15f1 and 2017.4.28f1 it worked perfectly fine.

    upload_2019-8-11_11-19-9.png
    upload_2019-8-11_11-19-43.png
    this is another approach, with the skirt isolated...
    upload_2019-8-11_11-31-10.png

    if you want that skirt for reproducing and testing, ask me. i can give you the isolated skirt. But you should be able to archieve the very same results with any mesh (with or without armature, doesn't matter) from blender (and probably any other 3D modelling software)...
     
  2. PiggyBanks

    PiggyBanks

    Joined:
    Nov 23, 2015
    Posts:
    5
    I have the exact same problem!


    upload_2019-8-13_12-56-54.png

    It was fine this morning before I updated from 2019.1 to 2019.2. Let me know if you find a fix, I'll let you know if I find one.
     

    Attached Files:

  3. SomeGuy22

    SomeGuy22

    Joined:
    Jun 3, 2011
    Posts:
    629
    Same is happening to me. This seems like an extremely critical bug. I've tried damping, stretching and bending stiffness, surface penetration options, constraints, solver frequency, friction, everything. I even played around with the external accel a bit but it did nothing to help.



    The cloth gravity appears to be no longer in the downward world direction. That's my best explanation for it, but I also got some inflation when my cloth had thickness and I'm not sure if that's related.

    This is the second time I can think of where cloth has been just completely broken from a major update :( back in Unity 5 there was a bug that consistently caused Unity to crash while using cloths which didn't get patched for months. Anyways, I realize it's hard to code for because it's likely tied in closely to everything, so let's just try to get a dev to figure out the issue. I really need it fixed within the next few weeks as it makes up such a huge part of my character and don't want to be tweaking last minute. I even tested it with other objects to make sure it's not my mesh and sure enough the cloth goes flying sideways.

    I'm going to submit a bug report and see what the Unity team can do. Reproducing it is extremely simple: if you place a plane down and add a cloth with the default settings, it won't fall in playmode. It'll just fly off to the side. If you constrain the top vertices to be distance: 0, then you'll get the bottom part floating as if it had no gravity, as seen in the screenshot.

    EDIT: Looks like there's already an issue tracker submission for this. It says there's a fix in review so maybe we'll get an update soon. Go vote on it if you can so they'll put it on priority.
     
    Last edited: Aug 14, 2019
  4. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,289
    Just wondering if this issue is still causing trouble to you @SupraLP @PiggyBanks @SomeGuy22? (I'm using Unity 2019.2 and export FBX from Blender.)

    I bumped into similar problem yesterday, spent hours wondering what was causing the cloth to literally explode to a mess and bounce around the screen, or sometimes more mild effects happened, like the cloth got seemingly pulled upwards or some area of the cloth crumpled. No matter what settings I adjusted in Cloth, I couldn't get rid of these faults.)

    What caught my eye was when I brought in various debug objects from Blender was that some of the vertices started to move to weird directions when cloth simulation was started. With a cylinder that had the top edge pinned to place, vertex from bottom of the cylinder got moved up to a vertex in top of the cylinder, pulling majority of cloth there... I knew my meshes were most likely totally OK in blender and in the FBX file, so something must have happened to them when I imported them. So, I checked import settings, disabled all optimizations and suddenly those errors didn't happen any more.

    So I think at least in some situations importer might be the reason. At least it was for me.

    My settings were these:
    (I didn't start yet to debug what of the settings actually causes that fault for me)
    Mesh Compression: Off
    Optimize Mesh: Nothing
    Keep Quads: unticked
    Weld Vertices: unticked
    Index Format: Auto

    ( I doubt that these rest will affected to the outcome but I list them anyway:)
    Legacy Blend Shape Normals: unticked
    Normals: Import
    Blend Shape Normals: Calculate
    Normals Mode: Area and Angle Weighted
    Smoothing Source. Prefer Smoothing Groups
    Smoothing Angle: 60
    Tangents: Calculate Mikktspace
    Swap UVs: unticked
    Generate Lightmap UVs: unticked
     
  5. SupraLP

    SupraLP

    Joined:
    Apr 12, 2018
    Posts:
    5
    In unity 2019.3.0b6 seems to have it somewhat better, but still buggy. They claim its fixed... but it clearly still isn't...


    upload_2019-10-8_20-42-36.png
     
  6. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,289
    Did you try to disable optimizations? And then reimport the model after that. Not sure if it's necessary but just in case it refreshes some data in Unity.

    That faulty operation looks just like what I had here.
     
  7. SupraLP

    SupraLP

    Joined:
    Apr 12, 2018
    Posts:
    5
    I just set "optimize mesh" in the fbx import to nothing. it doesn't work either... still behaves wierdly
     
  8. SomeGuy22

    SomeGuy22

    Joined:
    Jun 3, 2011
    Posts:
    629
    The issue tracker which I linked was only about the bug with Cloth gravity, and it is fixed. The replication test was to put a plane with cloth and rotate it 90 degrees, only to see the plane fly in a weird direction in playmode. If you perform the test in new versions of Unity you will see that it doesn't happen anymore, thus the issue tracker claims it is fixed.

    There are other cloth-related bugs which have separate reports and issue trackers that I believe are still being looked at. Check out this thread for more information. I recently submitted a bug report with my findings from that thread but I never got an email back so the reporting system might've glitched out.

    EDIT: The mesh optimization fix worked for me when I got Cloth distortion and stretching in Editor. Looking closer at your picture its possible your colliders are causing the cloth to move weirdly, make sure you have them set where you want them, and try disabling colliders to see if it behaves as expected.
     
    Last edited: Oct 14, 2019
    Imperatoss likes this.
  9. DeathRace26

    DeathRace26

    Joined:
    May 26, 2019
    Posts:
    73
    I'm sorry but what in the actual F*** is wrong with cloth components. It broke in 2018.3 something with boundary issues. Now it happens even in 2019.3. Cloth stretches like hell. Why... just why cant you keep some things as they were working before... This is absolute agony to work with.... I can't rely on anything because it breaks every single hotfix release...
     
    atomicjoe and Imperatoss like this.
  10. SupraLP

    SupraLP

    Joined:
    Apr 12, 2018
    Posts:
    5
    During the beta phase of 2019.3 (b1 to b12) cloth issues have been greatly reduced. But they are definetely still there in f1.
    Some friends were able to use their mesh with no issues... I still have some issues on the skirt and other people have reported of having issues too.
    Tweaking the export settings in blender may help, but Unity really has to fix this stuff....
     
  11. SomeGuy22

    SomeGuy22

    Joined:
    Jun 3, 2011
    Posts:
    629
    That's just the nature of regression. New features even in unrelated components often overlap causing issues somewhere else. Normally they are able to find and patch this stuff relatively quickly, maybe within a month or so if it's critical. This time though, I've been having issues for the past 3 or 4 months so I don't know what the hold up is. However, I'm not one to assume that this is even remotely an easy task, so instead of screaming at them I find it's more productive to actually provide test cases that can narrow down the issue and make it easier to find. In other programs this wouldn't be as a big of an issue considering you can decrease the version and use an older build, but I don't think Unity 2019 projects can be converted into 2018 easily. They're at least aware of what's going so I wouldn't doubt that they are doing everything they can. If not, it would be prudent of them to put it on high priority as it's probably going to become a huge bottleneck for many projects soon.

    It looks like the bug is still marked as "Active" on the issue tracker instead of "Planned/fixed" so it's possible they've already discovered more things to fix. The 2019.3.0f1 build isn't actually listed as "official" yet, so it's not technically released right now. Perhaps that's why they're delaying it, or maybe they will just push back the fixes to some 2019.3.x build.
     
  12. NejoFTW

    NejoFTW

    Joined:
    Aug 11, 2016
    Posts:
    6
    Hi there boys and girls!
    It appears that I managed to fix my cloth problem by following these steps(after all that I tried to fix the cloth on my basketball net I don't really know which of these steps helped me solve the issue, but it seems to be working for now in editor and builds!). What I did(Using Unity Editor v 2019.3.0f3) after cloth was broken upon porting to a newer version:

    -Obvious first step- BACKUP YOUR PROJECT NOW
    -Now prepare to remove the prefab with the cloth component from the scene AND project, you have backup dont worry :) you have to do it from scratch to work with this method(sorry I couldn't find any other way)
    -Delete the prefab containing the cloth component from the scenes and from the project, also removed 3d model source files from the project, maybe a reimport would fix it for you but it did not fix it for me...
    -Reimport the 3d models, if you click the root FBX files and go to "Model" settings you have to disable mesh optimisation(from everything to none). I think they changed the optimisation of the models which f****d up our cloths.
    -A wierd optional step which I recommend is if you are using multiple monitor setup for the time of fixing your cloth you should shrink your workspace to just 1 window(I can't really say if it helped, but I was finally able to fix the problem when I did it by recommendation of a friend).
    -At this point I would like to mention that when trying to paint my constraints with the brush the brush still did NOT WORK. Also at some camera angles I was unable to see any of constraints in the editor window. Instead of paint mode go to "Select" mode in the constraint painting popup, select your vertices you want to affect, tick the checkbox for MaxDistance and set your value there.
    -Pray to a random entity of your choice that it's fixed.
    I believe this was all it took to make it work again, I guess there was some incompatibility between mesh optimisations and the cloth component, so doing it from scratch atm looks like it fixes the problem, at least for me... Good luck, commanders
     
    Apokrit and tencentwesley like this.
  13. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,608
    Wow. That's one major pain a few weeks before release to have to redo all our cloths.
     
  14. tencentwesley

    tencentwesley

    Joined:
    Mar 30, 2019
    Posts:
    1
    It work for me when I turn the Optimize Meth setting to Nothing .
     
  15. SomeGuy22

    SomeGuy22

    Joined:
    Jun 3, 2011
    Posts:
    629
    I didn't even have to do that to get my cloth working mostly as expected. If you use Unity 2019.3.4 the basic features should be back to normal. In my testing it seems as though some weird forces are still applied to Cloth but they aren't too noticeable and might be because of me using random velocity, though even at small values it has a bigger than expected effect. Surface penetration also isn't working as it bugs out cloth behavior, you can vote for the issue here. Other than that my replication tests for previous Unity versions all pass, cloth gravity is correct and they aren't flying around like crazy anymore.

    I've also looked into Magica Cloth which I've been told is a good alternative to Unity's component, and may have some crucial stylistic advantages/optimizations due to virtual cloth points. I haven't bought it yet since it seems like Unity's 2019.3.4 Cloth should be good enough for now, but if you're intent on having something potentially more stable you can check out Magica here. Though be warned, there's no guarantee of any fixes when you buy an asset and there may be problems with Magica right now. But the dev behind it seems to be very responsive and proactive on adding new features/fixes.
     
unityunity