Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Physics Obi Particle Based Physics (Cloth, Rope, Fluid) thread

Discussion in 'Tools In Progress' started by arkano22, Jun 30, 2015.

?

Performance vs compatibility

Poll closed Oct 9, 2015.
  1. I don't care about performance, keep my data intact please.

    0 vote(s)
    0.0%
  2. I don't care if I have to re-do some stuff, as long as it runs faster.

    14 vote(s)
    100.0%
  1. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    That sounds great, because I need the rope to be in a special layer for lighting purposes, but I forgot that the rope needs to be in its own layer for collision purposes.

    But I'm still having real trouble with your .dll files. Even though I've rebooted my computer since the last time I mentioned this, for some reason the .dll refuses to unload on my machine:

    Capture.JPG

    EDIT: This happens BOTH on the work Windows 7 machine and on my home Windows 10 machine. Is there anything our IT staff can do to help diagnose this? I am unable to upgrade to 3.1 because of this.

    EDIT: I tried to press "Cancel" which apparently installed everything but the new version of the .dll, causing Unity to crash. I then tried to revert by copying the Obi folder from the backup machine, but now I get the following new error:

    I'm currently locked out from using Obi Rope in my Unity project. :(
     
    Last edited: Jun 21, 2017
  2. eyier

    eyier

    Joined:
    Aug 29, 2016
    Posts:
    6
    Hi arcane,
    sorry, my response has become slow.
    I'll try now!

    and,
    I'd like to link cloth and cloth.
    Is this plan possible?
    ex. [plane cloth] + [obi pin constrains] + [plane cloth] + [obi pin constrains] + [plane cloth] = L-shaped cloth
    (I'd like to tear cloth with a little complicated shape...)

    thank you
     
  3. tinyant

    tinyant

    Joined:
    Aug 28, 2015
    Posts:
    127
    Every time When I Click play button ,Unity3d Crash!

    I have set up my cloth by following http://obi.virtualmethodstudio.com/tutorials/unitychanclothing.html

    When The code step into

    Oni.SetDeformableMeshBoneTransforms(deformableMesh,bones);

    Oni.SetDeformableMeshAnimationData(deformableMesh,bindPoses,weights,rendererBindPoses.Length);

    Unity3d crash everytime!
    I have no idea about this 100% crash when the code step into C++ code. I have tried many times resetup my Obi Cloth!
    @arkano22 Thanks
    I report my problem to obi group with attached my character fbx.I you can make some check about this fbx file.
     
    Last edited: Jun 22, 2017
  4. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi tinyant,
    I already answered you in our support mail. We cannot reproduce the crash in 3.1, make sure you upgraded your version.
    cheers,
     
    tinyant likes this.
  5. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Well, our .dll files have nothing special. Unity should be able to copy them just fine when importing the package. No other user has reported similar problems.

    I´d start by making a clean import of the asset. Remove the /Obi folder completely, and reimport the package.

    Edit: regarding the dll unloading issue, I did some tests in Win 7 and 10 (10 being run using VirtualBox). Both unload the 64 and 32 bit .dlls just fine when closing the Unity editor, and when closing a standalone game. I´m running Unity 5.6.1. Using process explorer to track the .dll:



    Also, I´m pretty sure that when you reboot a computer all dlls are unloaded, and only loaded when any application requires them, so I think your problem stems from something else. Afaik, there are no .dlls able to survive a reboot.

    Edit2: Could it be that your antivirus is picking up the .dlls and putting them in quarantine / holding them hostage? Try disabling it, or putting Unity in its whitelist...a quick googling shows other Unity users having similar problems with dlls.
     
    Last edited: Jun 22, 2017
  6. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi eyler,
    You can use the ObiSticther component. This will allow you to merge together separate pieces of cloth.
    Pin constraints only work with rigidbodies.
     
  7. OnlyVR

    OnlyVR

    Joined:
    Oct 5, 2015
    Posts:
    55
    Hi Arcano,

    I've tried to add the Ethan character to the ClothRigidbodyInteraction scene. I've set him in the same location as the Sphere object and set the same Rigidbody parameters. Unfortunately it goes throw the cloth without any interaction. I've tried to remove the Rigidbody component and manually move Ethan very slowly. I can see there is a very week interaction. The Sphere object interaction near the perfect in the same conditions.
    Why is there so big different in the behavior between MeshCollider and primitive colliers? I understand the possible performance issue but is is not the case.
     
  8. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Mesh colliders are "hollow", primitive colliders are not.

    This means that if a cloth particle gets completely inside a primitive collider, it will be projected outside. However if a particle goes trough the thin surface of a mesh collider without intersecting it in a previous frame, it will stay inside since there's no (fast) way to tell if a point is inside an arbitrary non convex mesh.

    Fast moving particles colliding against a static mesh collider pose no problem since Obi uses speculative contacts for continuous collision detection. However moving mesh colliders against particles will always have this problem. For this reason nonconvex MeshColliders should always be used for static level geometry. Since the floor and/or walls of a level never move, this becomes a non-issue.

    You can somewhat alleviate the problem by adding a ObiCollider component to the Ethan object and increasing its "thickness" value. Note that this doesn't fix the core issue, it just makes it more unlikely to miss collisions.

    Also note that this is not a Obi-specific issue, it even has a name for it: "tunneling". It's a fundamental consequence of how realtime collision detection works in general. This is also why the console will show the following error in Unity 5 or above when trying to use a non-convex mesh collider with a rigidbody:

    "Non-convex MeshCollider with non-kinematic Rigidbody is no longer supported in Unity 5."

    I assume before Unity 5, non-convex non-kinematic rigidbodies got decomposed into multiple convex colliders, but this is no longer the case for performance/robustness/ease of maintenance/whatever reasons.
     
    Last edited: Jun 26, 2017
  9. eyier

    eyier

    Joined:
    Aug 29, 2016
    Posts:
    6
    Hi arcane,
    Thank you very much for your advice.
    but I don't understand how to use ObiStitcther component...

    I set cloth of the same solver to a component.
    and I pressed Edit...
    Please tell me an after procedure.

    thank you.
     
  10. eyier

    eyier

    Joined:
    Aug 29, 2016
    Posts:
    6
    Hi arcane,
    Sorry,I understood how to use the tool finally.
    A tool was difficult to see as me...

    thank you.
     
  11. mrbdrm

    mrbdrm

    Joined:
    Mar 22, 2009
    Posts:
    510
    i am getting frustrated with the cloth getting inside the character model, i have used collides but they can't get to the shape of the model correctly and the Skin backstop doesn't help stopping the vertices from going back to the model(i have set it to 0).
    my character have a coat that is the cloth.
    and for some reason the particles editor will ignore any changes i do to the vertices property (e. g. mass) after a while with me trying to fine tune the values and i have to re initialize the model again and restart my work this happen randomly.
    i am using latest unity on windows 10
     
  12. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi mrbdrm,

    We haven´t received any reports regarding the particle editor ignoring changes (internally it simply sets a value in an array). We´ll look at it to see if we can reproduce it, but I´ll appreciate if you could send a repro scene that shows the issue.

    About the skin backstop, make sure that the actual shape of your coat doesn´t clip with the character mesh when the cloth component is disabled, as a backstop of 0 will stop the particles exactly at their skinned position.

    cheers,
     
  13. R0man

    R0man

    Joined:
    Jul 10, 2011
    Posts:
    90
    Would it be possible to use this for soft body deformation like bending steel and stuff?
     
  14. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi R0man,

    Not really. Steel is orders of magnitude more rigid that cloth. You need a dedicated softbody simulation for that.

    cheers,
     
  15. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    507
    Should I first skin my cloth with my character's biped then use Obi or I can just use a mesh as cloth with Obi?
     
  16. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    If you're creating cloth for a character, then yes you should skin the cloth to the same skeleton used by the character.
     
  17. Tmtakala

    Tmtakala

    Joined:
    Mar 12, 2014
    Posts:
    16
    I couldn't find any thread for Obi Rope, so I'll ask my question here:
    Any plans to add PlayStation 4 support for Obi Rope? If so, what is the rough schedule?
     
  18. maccoy

    maccoy

    Joined:
    Mar 4, 2015
    Posts:
    12
    hm, after much headscratching, i figured out that liboni.dll causes unity.exe to stick around in the task manager after i quit the application..
    the same happens for a built project.

    ive also had to completely remove the addon before updating it cause liboni.dll gave me access denied errors.
    i can turn it on and off again with no issues if i just disables the use of the liboni.dll in unity and in the built project.....
     
  19. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi maccoy,

    I tested this same thing for another user in this thread (you'll find the post in this same page). In all the tests I performed, the library got unloaded perfectly when closing the editor or the standalone. (In fact unloading is not the library's responsibility, but Unity's. I have no control at all over it.)

    Turns out his antivirus was blocking the dll for some reason, holding onto it and preventing the library from being unloaded. Most probable cause, it is running checks on it and prevents anyone from changing the file while it is done deciding what to do with it. It might be the case for you too, double check it just in case yours is an unrelated issue.
     
    Last edited: Aug 7, 2017
  20. SandiagoChan

    SandiagoChan

    Joined:
    Aug 8, 2017
    Posts:
    19
    Hi,arkano:
    I have an ObiCloth attached a mesh(like pic below). you can see that mesh is combined with body and dress.To initialize an obicloth, I create a obiclothtopology attached the mesh.
    The question is: when editting the role, this mesh would change( become fat), so the cloth will not suitable to the body.How to deal with this situation?
    Thanks!
     

    Attached Files:

    Last edited: Aug 8, 2017
  21. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi!

    I'm not sure I understand your question. What do you mean by "when editting the role, this mesh would change( become fat)". Are you trying to use blendshapes to change the shape of the body mesh?

    cheers,
     
  22. SandiagoChan

    SandiagoChan

    Joined:
    Aug 8, 2017
    Posts:
    19
    Similar to blendshapes,edit functions would adjust vertices' position, recalculate normals,bindposes. But the count of vertices would not change.
     
  23. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    If the mesh changes shape, the cloth should change its shape too. This involves re-generating the topology and re-initializing the cloth.

    This is because the rest shape of the cloth is defined by inter-vertex distances and angles (for distance, tether and bend constraints), and per-vertex tangent space basis and bind poses (for skin constraints). These change quite a lot if you move mesh vertices around, even though the count/ordering of vertices would not change. So the only option here is to re-generate the cloth. This is a time consuming process, but if you're doing it only once at runtime (and not every frame!) then it's ok.

    See the included RuntimeCloth scene for an example on how to create cloth at runtime, even from completely procedural meshes. Specifically, RuntimeClothGenerator.cs.
     
  24. mrbdrm

    mrbdrm

    Joined:
    Mar 22, 2009
    Posts:
    510
    Hi
    every time i try to press play unity crash.
    i am trying to skin low poly model (4k vert) to high poly model (8k vert) the mesh have shell modifier from 3ds max
    if i don't use the proxy the cloth will run.
    i can send you the coat that i want to make as a cloth physics to my character if this will help.
     
  25. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi all,

    Obi 3.2 is near completion. We haven't added much new features this time.

    Instead, we took the collision system back to the drawing board and made it all better. Most of the feedback we got for previous versions had to do with the collision setup workflow, so we focused on that.

    You can read the details here:
    http://blog.virtualmethodstudio.com/2017/08/obi-3-2-whats-new/

    hope you'll enjoy it!
     
    Last edited: Aug 23, 2017
    ekergraphics likes this.
  26. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    Fantastic. This was one of the more complex assets I've purchased (and I'm still struggling with setting up and attaching new ropes), so putting more "ease of use" in it is very welcome news!
     
  27. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    I look forward to using this on a current character. The one I am working on now will have two simulated parts on him... should be fun to animate.
     
    arkano22 likes this.
  28. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    Is there a tutorial on cloth set up using this? The model I am working on has two pieces that will be simulated, the lower part of a t-shirt, and the majority of a jacket. And he will have to move fast during battle...
     
  29. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    You must use skin constraints to set up simulation for characters. They are used to blend simulation and animation together, in a way that guarantees that fast character motion won't cause the cloth to tangle or get into a weird state. Here's a tutorial on how to setup simulation for a skirt:

    http://obi.virtualmethodstudio.com/tutorials/unitychanclothing.html

    Making the lower part of a shirt is essentially the same, step by step. (also if you´ve ever used Nvidia Apex, the concept is identical).
     
  30. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    I wished I had APEX. Also I do remember you mentioning that it will would more performant if the simulated parts were separate meshes, but in my case it may not be possible.
     
  31. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Actually, Unity's default cloth solver is Apex. However it is so poorly integrated that using it effectively is nothing short of impossible. If you've used it outside of Unity (trough their Maya plugin, for instance) then the concepts and parameter names (backstop, skin radius, etc) should sound familiar.

    Keeping the cloth as a separate mesh is slightly more performant. However if you use a single mesh, keep most particles in the character fixed and you click "optimize" in the cloth inspector, then the difference in performance will be very small. By clicking "optimize", all non-cloth (fixed) particles are excluded from the simulation, and all constraints affecting them will be removed from the solver. This means the only actual overhead of having a single mesh is slightly higher memory consumption, as the solver has to "remember" that deactivated particles are still there to allow for non-destructive optimization (that is, being able to un-optimize if needed).
     
  32. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    Good to know. Looking forward to using Obi Cloth
     
  33. SandiagoChan

    SandiagoChan

    Joined:
    Aug 8, 2017
    Posts:
    19
    Dear arkano:
    I found there is no document about how to update obi plugins to another version.I tried to import 3.1.1 version obi package and override 3.0 version. But it does not work well. Would you please support an official and compatible method? thx much!
     
  34. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi!

    Just importing the new .unitypackage file should work (at least it does for everybody). This is standard procedure for all Unity assets, not just Obi, so that's why we didn't write any specific guide on doing this. Updating/adding individual files is taken care of automatically by Unity, there's nothing special to be taken care of on your part.

    If you're facing issues, I'd suggest: remove the /Obi folder from your project, restart Unity, and import the new package.

    Let me know how it went, if you still have problems don't hesitate to get back to me.
     
  35. SandiagoChan

    SandiagoChan

    Joined:
    Aug 8, 2017
    Posts:
    19
    I have tried these two ways:
    1.Importing 3.1.1 package to a project with 3.0 obi plugin.
    2.Export 3.0 package, and import it to an empty project. Then import 3.1.1 package.
    Both two ways lead to an err: when click EditParticles, the material named "PropertyGradienMaterial" can not found, the object is null. Show pic below.
    Would you please offer an email address so that I could send a 3.0 package exported from project. I think this is a most effective way. Thx a lot.
     

    Attached Files:

    • err.png
      err.png
      File size:
      11.5 KB
      Views:
      956
    • err2.png
      err2.png
      File size:
      8.8 KB
      Views:
      993
  36. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi,

    Just tried to import 3.1.1 in a project that contains 3.0, works fine for me.
    Try removing the whole /Obi folder from your project, restarting Unity and importing 3.1.1.

    Method #2 will not work at all, since 3.0 installs stuff outside of the /Obi folder (one of them is PropertyGradientMaterial). So once you export 3.0 to a package and import it to an empty project, it will stop working due to missing references. There are resources not contained in the /Obi folder and consequently missing from the package (which is precisely what you're seeing). For this to work, you would have to manually undo the procedure performed by the installer before exporting the package (however I don´t see the point in doing this).

    You can send whatever you need to our support email (support(at)virtualmethodstudio.com). Anyway I don´t quite see how sending a package containing the 3.0 folder would help in resolving this issue....:oops:
     
    Last edited: Aug 29, 2017
  37. SandiagoChan

    SandiagoChan

    Joined:
    Aug 8, 2017
    Posts:
    19
    Hi.
    I tried just like you said: delete Obi folder, and restart Unity , import 3.1.1 package. But it still hint the same error.
    And as you know, after install 3.0 obi, it would produce extra files and folders, like "Editor default resources" folder. How to deal with these stuff when deleting 3.0 obi folder? Should I found all of them in project and delete them?
     
  38. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi,

    Yes, there are two folders outside of /Obi: /Gizmos and /Editor default resources. You should delete both of them.
     
  39. SandiagoChan

    SandiagoChan

    Joined:
    Aug 8, 2017
    Posts:
    19
    Thanks a lot. I upgrade successfully.
    Another question:I need to load a prefab with ObiCloth component at runtime. So an ObiSolver component need to be load and set some parameters.Here are the orders:

    GameObject ClothMesh = Resources.load<GameBbject>("obiCloth"); //ObiCloth component is unable.
    Mesh mesh = ClothMesh.GetComponent<SkinnedMeshRenderer>().sharedmesh;
    ObiCloth obiCloth = ClothMesh.GetComponent<ObiCloth>();
    ObiSolver solver = ClothMesh.AddComponent<ObiSolver>(); //ObiSolver is enable when added
    solver.simulateInLocalSpace = true;
    solver.maxParticles = Mathf.Max(solver.maxParticles,mesh.vertexCount); //set obisolver particlecount
    solver.Initialize();
    solver.Start(); //without Initialize and Start function, the project crash.
    obiCloth.Solver = solver;
    obiCloth.enabled = true;

    These codes did work at 3.0 package,but not at 3.1.1. ObiCloth cannot wave when gameobject move.
    If I load ObiCloth by code, but add ObiSolver,set parameter and connect to cloth manually, it works.
    So, could you tell me anything incorrect about the code?
     
  40. joeri_07

    joeri_07

    Joined:
    Dec 18, 2015
    Posts:
    45
    Hi,

    Is there a way by using obi cloth to make a cloth behave flexible but NEVER go through the skin of the mesh the cloth is wrapped around?

    what I'm doing now to make it work is= select the torso of my model, puth a obi cloth on there. put a obisolver and mesh topology of my dress. If I do that it works but my torso disappears. why is that? I'm duplicating the torso now so that a second copy on the same position is making it visible.... Also when I start moving the torso around (up and down) the dress is behaving very realistic (which is awesome) but it goes through the skin of the torso sometimes...

    please help. thnx!
     
  41. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi!

    Your torso and dress must be different objects. A single object cannot have more than one MeshRenderer/SkinnedMeshRenderer component in Unity.

    If you're setting up the cloth to use the topology of a dress, then it replaces whatever mesh your object had with that of a dress. You cannot have a dress-shaped torso, can you? ;) When you add the ObiCloth component to an object, it uses its MeshRenderer/SkinnedMeshRenderer to render the topology you set.

    The industry-standard approach to character clothing (which is what I assume you're trying to accomplish here) is to skin the dress mesh to the same skeleton as the torso/body/character mesh. Then, use skin constraints's backstop property to ensure the cloth doesn´t penetrate the character body. Again, note that body and cloth are different meshes. (technically you could use only one mesh for both if you really wanted, but you'd have to paint different vertex properties for each part. If you're starting out, just use two meshes, two objects).

    See this tutorial on how to set up a skirt for a character using this method:
    http://obi.virtualmethodstudio.com/tutorials/unitychanclothing.html

    cheers!
     
    Last edited: Aug 31, 2017
  42. SandiagoChan

    SandiagoChan

    Joined:
    Aug 8, 2017
    Posts:
    19
    Actually, I combine the torso with cloth just like pic below.How to deal with this situation?
     

    Attached Files:

  43. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    As I just pointed out to joeri_07, you generate the topology for the entire mesh, then use the particle editor to paint appropriate properties for cloth and non-cloth parts of the mesh.

    As a guideline, you should fix all particles in arms and chest (will be shown in red), and leave the cloth particles unfixed (will be shown in blue). Then optimize out all fixed particles by clicking "Optimize" in the inspector, and focus on the cloth particles to give them appropriate skin values. (See the skin constraints manual page: http://obi.virtualmethodstudio.com/tutorials/skinconstraints.html)
     
  44. joeri_07

    joeri_07

    Joined:
    Dec 18, 2015
    Posts:
    45
    Hi arkano,

    Thnx for your answer. I followed your advice and I think I'm getting closer to the result, but I'm still struggeling.

    So now I have put a obiCloth script on my dress, and gave it a topology (the same mesh) and a solver. The problem I am facing is still the same... some vertices of the dress go through the body of my model. I don't want to refrain it from being dynamic and flexible, but I don't want it to penetrate the skin! I read about your skin modifier and from what I understand is that ... if I take all particles of the dress and put the backstop value to something bigger than 0. The dress would only be able to simulate in the direction of the normal of the related vertex. Is this correct? This however is not the case when I test it out. If i put my model horizontally and let gravity do it's work, the dress still penetrates the skin.

    Something else I want to know is the following: In how far does weight-painting before importing the model into Unity, let's say in Blender affect the behaviour of ObiCloth? Maybe the backstop propery doesn't work because the weightpainted vertices in Blender are not all fixed to the bone but are a bit loose...

    I need to finish this up very quickly for a project so any help much appreciated! And thank you for the help thus far :)

    J
     
  45. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi there,

    The backstop value does not constraint the particle to move only in the direction of the normal. It determines how much penetration is allowed in the direction of the normal, but the particle is still allowed to move in any direction tangential to the surface, within the radius specified by the "skin radius" property.

    Start with a backstop of 0 (so that the cloth is not allowed to get closer to the skin than what the animation dictates), a fairly large backstop radius (eg 4), so that the shape of the backstop surface is almost planar (low backstop radius make the surface behind each particle rounder, which is useful for knees, shoulders, etc) and a very low skin radius (0.001). Then slowly start making the skin radius bigger and work from there.

    The skin weights you import from Blender (Maya, 3Dsmax, whatever) affect 100% of the behaviour of ObiCloth, since the simulation is added on top of the animated result. The backstop, skin, radius values are relative to the skinned (animated) position of your vertices. So if your dress goes trough the model or has clipping problems without ObiCloth, it will have the exact same problems (or worse) when you add ObiCloth! Make sure your skin weights are perfect before adding any simulation on top.
     
  46. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    315
    3.2 looks like a giant step in the right direction for ease of use, as far as colliders are concerned. Good work @arkano22!
     
    arkano22 likes this.
  47. joeri_07

    joeri_07

    Joined:
    Dec 18, 2015
    Posts:
    45
    Ok I think the problem was the original bone weights being not stiff enough. Thnx!
    I have another question though: when i import a model, make an obicloth and edit it untill satisfied, when I then scale that model down. (the GameObject with the obiCloth script) and enter playmode, the cloth is chaotic and spikey and all messed up. It seems that it is somehow using the information before thescaling t calculate the cloth simulation? How an this be solved?

    Thnx!
     
  48. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Hi!

    You cannot scale cloth once you've generated the topology, if you're simulating in world space. Cloth simulation (not just in Obi) works by constraining distances and angles between mesh vertices. These are invariant under cloth rotation and translation. However they'll change wildly once you scale the cloth. You'd have to re-generate the topology every time you modify the scale to recalculate new rest inter-vertex distances and angles, something that's not doable in realtime.

    The usual way to approach this, if you absolutely need to scale your model at runtime, is to perform the simulation in local space. To do so, enable this option in your ObiSolver, and make your cloth a child of the solver transform.
    This will allow you to change the scale of your simulation at runtime by scaling the solver transform.

    This works because the scale of the solver affects the entire space in which the simulation takes place, not just mesh vertex positions.
     
  49. joeri_07

    joeri_07

    Joined:
    Dec 18, 2015
    Posts:
    45
    Parenting to the solver worked!

    Thank you
     
  50. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    @arkano22 Hi there, I'm experimenting currently with the default Unity cloth and I stumbled upon a big issue with the fact that if you set up you cloth mesh in the editor and then add a vertex to your mesh (in your 3D app) and reimport it into Unity then the cloth mesh in the editor blows up. Which can probably be explained by vertex order being different. But it forces you to then repaint all the influences.

    This is of course terrible, from a pure practicality point of view. So I was wondering: does Obi suffer from the same limitation? If so, is there a way to simply "save" the current mesh vertex settings and then re-apply them to the newly tweaked mesh, based on vertex position?