Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[RELEASED] MagicaCloth2 - Hybrid Cloth Simulation

Discussion in 'Assets and Asset Store' started by hoshos, Feb 5, 2023.

  1. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    320
    Hello, is box collision on the road map?
     
  2. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    807
    Yes, it's already added to the roadmap.
    https://magicasoft.jp/en/mc2_roadmap/

    However, the implementation date has not yet been determined.
    There are two work schedules for this year, so it will probably be after that.

    1.BoneSpring components
    2. Implementation of bake mode
     
    ikazrima likes this.
  3. wechat_os_Qy09VpiDaSiV8EETWQqNeGZuk

    wechat_os_Qy09VpiDaSiV8EETWQqNeGZuk

    Joined:
    Oct 11, 2021
    Posts:
    22
    Does the amount of mesh cloth affect performance? Currently my character's body and cloth are from the same mesh, and I don't know if I could split them to save more performance.
    And if I don't split them, when using simple distance, my character's ass will be merged with skirt, but if I use shape distance, my character's skirt would go through her long coat, which may force me to use self collision, they all may cause problem.
     
  4. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    807
    Performance is proportional to the number of mesh vertices.
    Therefore, the smaller the number of vertices, the better the performance.
    It is better to have separate meshes for the character's body and clothing.
    Otherwise, the configuration will be difficult and an unnecessary load will be generated.
     
  5. Claudia_Schulz

    Claudia_Schulz

    Joined:
    May 12, 2020
    Posts:
    6
    Hello!

    We're currently on version 2.3.0 and have encountered a bug in the editor and I'm not quite sure if I can fix it on my end. In our project, we're instantiating character prefabs + their clothing prefabs and attach clothing to the character (stopping automatic magica build on Start() and initiating a build manually after the character is put together properly). When a character is disposed off, they go back into an object pool for better reusability and performance. When I instantiate a character, dispose of them, and instantiate it again in quick succession, I will get the following error:

    Code (CSharp):
    1. A Native Collection has not been disposed, resulting in a memory leak. Allocated from:
    2. Unity.Collections.NativeArray`1:.ctor(Int32, Allocator, NativeArrayOptions)
    3. MagicaCloth2.RenderSetupData:ReadTransformInformation(Boolean)
    originally entering the magicaCloth codebase via
    Code (CSharp):
    1. MagicaCloth2.MagicaCloth:Initialize()
    Is there a method I need to call when cleaning up/disposing my characters/prefabs that have a magica build running?
     
  6. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    807
    Hello.
    There are some rules when using MagicaCloth in an object pool.

    (1) Please perform Initialize() and BuildAndRun() only when instantiating for the first time.
    (2) Only use SetActive() or enable/disable components to put in and take out objects from the object pool.
    (3) When taking it out from the object pool, it is a good idea to reset the simulation with ResetCloth()

    First, please make sure that you follow these rules.
    Basically, calling Initialize() or BuildAndRun() more than once may result in an error in some cases.
    If you want to return MagicaCloth to the object pool, simply disable the component.
    After retrieving from the object pool, the simulation is reinitialized by ResetCloth().
    https://magicasoft.jp/en/mc2_api_magicacloth/#ResetCloth
     
    hopeful likes this.
  7. Claudia_Schulz

    Claudia_Schulz

    Joined:
    May 12, 2020
    Posts:
    6
    Hi again! Thanks for the quick reply and the very valuable info on object pooling with Magica! :)
    I did some more testing today and realised that I was only half right about what I wrote in the earlier post. While we are object pooling the characters, we are not actually pooling the objects that use Magica components. So the error occurred when I destroyed such an object right after instantiating/initiating it, so the magica cloth build was still in progress when the object was deleted.
    I think I fixed it by calling Process.Dispose() before destroying the magica component carrying objects.
    Do you think that makes sense? Is there anything else that needs to be disposed of/cleaned up in a case where the cloth build is in progress but the object is supposed to be destroyed?
     
  8. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    807
    There is no problem with destroying objects during the build.
    We have designed it that way and tested it for quite a long time.
    So there is no need to perform any processing when destroying it.

    However, there may still be an unknown defect.
    Is this easily reproducible?
    If so, can I get a project that can reproduce it?
     
  9. Claudia_Schulz

    Claudia_Schulz

    Joined:
    May 12, 2020
    Posts:
    6
    Hello :)
    I've managed to recreate the error in the RuntimeDressUp demo by making some slight changes to it. Will send you the details :)
     
  10. SolarianZ

    SolarianZ

    Joined:
    Jun 13, 2017
    Posts:
    215
    Hi, does that mean there's a Blend Weight feature now?

     
  11. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    807
    Yes, BlendWeight functionality has already been implemented.
    This is an internal property that is not visible in the inspector.
    By manipulating this blendWeight, it is possible to blend the simulation results and the original shape.
    https://magicasoft.jp/en/mc2_api_clothserializedata/#blendWeight
     
    SolarianZ likes this.
  12. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    807
    Update:2.3.2

    v2.3.2 has been released on the Asset Store!
    https://u3d.as/2Zc3

    Some bugs have been fixed.

    Release Note:
    Fix: Fixed an issue where a memory leak would occur if a MagicaCloth component was added with GameObject disabled, initialized manually, and then discarded while it was disabled.
    Fix: Fixed it so that more than 16 renderers could not be set in MeshCloth. The maximum number of renderers that can be set is 15.
    Fix: Fixed an issue where a compilation warning occurred in Unity2023.

    How to Update
    Please follow the following steps to update the software as much as possible.
    (1)Backup your project
    (2)Delete the MagicaCloth2 folder from the Unity editor
    (3)Import the latest MagicaCloth2 from PackageManager
     
    Claudia_Schulz likes this.
  13. arimintzu

    arimintzu

    Joined:
    Jan 7, 2019
    Posts:
    5
    Hi, awesome work as ever. I’ve been using magica cloth for some time. There’s a feature i need to know if its do-able or not (present or maybe future).

    i know there’s spring component in the roadmap, and it also said add collision on it.
    Does it mean it will support the collision of the bone spring to the global collider?
    Example i have bone spring on busts, if it collides with box collider in the world it will be springing?

    and when it will be launched if i may know?
    Thanks in advance
     
  14. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    807
    Hello.
    We are currently experimenting with plans to add collision detection to the new BoneSpring.
    BoneSpring will be available soon.

    However, Ver2.x does not have the global collider function.
    It was included in Ver1.x, but since it was implemented using a fairly aggressive method last time, it was discontinued in Ver2.x.
    However, in Ver2.x, you can easily add and remove collider to the cloth component.
    You will be able to take advantage of this feature.
    https://magicasoft.jp/en/mc2_runtimechanges/

    Also, box collider has not been implemented yet.
    It's on the roadmap and I'd like to experiment with it in the near future.
     
  15. arimintzu

    arimintzu

    Joined:
    Jan 7, 2019
    Posts:
    5
    i see. But can i use magica cloth for busts?
     
  16. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    807
    of course!
    BoneSpring will be added soon, so please try using it.
    I think BoneSpring is mostly used for shaking the chest.
     
  17. RabberDakk

    RabberDakk

    Joined:
    Feb 23, 2019
    Posts:
    6
    can't wait magica spring bone :)
    I often use it to chest and hair
     
    hoshos likes this.