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

[RELEASED] Magica Cloth

Discussion in 'Assets and Asset Store' started by hoshos, Jan 22, 2020.

  1. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    Is this normal that I cannot set length of a capsule collider to be more than 1 ?
     
  2. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    Magica Cloth is designed for the human body.
    Therefore, I think that a collider over 1m is unnecessary.
    If you want to make the collider bigger, increase the scale of the collider's Transform.
    The size of the collider affects the scale of the Transform.
     
  3. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    If you can do it by scaling transform than why such a limitation at all ?
    Is this just hard-coded limitation ?
     
  4. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    No, there are no restrictions.
    The slider is used to make it easier for the user to adjust.
    And when you install a slider in Unity, you need to decide the minimum value and the maximum value.
    Therefore, the maximum value is currently 1.0 (1m).
     
  5. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    Can you tell me how can I release this limitation ?
     
  6. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    See the code below for restrictions on colliders.
    MagicaCapsuleCollider.cs
    MagicaPlaneCollider.cs
    MagicaSphereCollider.cs

    It can be expanded by rewriting the definition of [Range (0, 1)].
     
    Last edited: Dec 6, 2021
  7. huanghonghong

    huanghonghong

    Joined:
    Jul 8, 2021
    Posts:
    6
    HI,forgive my poor English.
    I want the chain to collide with the Plane. I add the sphere collision at the chain node and add the collision to the Plane, but this is not work, because the collision does not move with the chain.Is there any way to solve this problem?
    upload_2021-12-10_18-3-47.png upload_2021-12-10_18-47-10.png upload_2021-12-10_18-47-34.png upload_2021-12-10_18-49-16.gif
     
  8. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello!
    Unfortunately, it is currently not possible to add another collider to a Transform running on BoneCloth.
    Therefore, to solve this problem, you need to switch the chain to a different control than BoneCloth.
    (For example, Unity's Physics system)
    The issue of this interaction is a topic for the future.
     
  9. lawsonh

    lawsonh

    Joined:
    Jul 25, 2018
    Posts:
    80
    Hi there, do you know what kind of component we should use for this kind of dress?


    We rigged the front and back parts of the dress, is it still ok to use BoneCloth mesh connection mode?
     
  10. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    Yes, I think BoneCloth is fine.
    If you're having trouble with mesh connections, try separate BoneCloth before and after.
     
  11. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    I have noticed troubling behavior.
    When I set time scale (speed up) my cloth behaves differently.
    Like it is not taking time scale into account so when I speed up time, clothes behave like if my character is moving faster.
     
  12. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    I'm sorry, MagicaCloth doesn't support timescales above 1.0.
    This was not specified in the documentation.
    Only slow playback less than 1.0 is supported.
     
  13. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    I will try to live with it, but may I ask why ?
    Mathematically speaking there should not be much problem to support speedup.
     
  14. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    Yes, there is no technical problem.
    This is a performance issue.
    The cloth simulation is the same as the physics simulation, and the calculation results are accumulated in a predetermined short time.
    This means that if the speed of time doubles, so does the load of the simulation.
    Therefore, Magica Cloth has a limit to ignore time scales of 1.0 and above.

    It is possible to remove this restriction, but I think it can only cover about twice the time scale.
    If you set it to 10x speed, the CPU load will probably be too large and it will be in a frozen state.
     
  15. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    222
    Edit:
    Nevermind, i had to add red dot points (fixed points) on top of the green ones to stabilize the movement. :p

    For some reason the characters hair goes ALLLL the way down to the Bottom of the scene. It melts through the floor and goes down to infinity.. why is this?
     
    Last edited: Dec 22, 2021
  16. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    Are you using v1.12.0 as the version?
    In the case of v1.12.0, there was a fatal problem with the global collider, so please update to v1.12.1.
     
  17. taylank

    taylank

    Joined:
    Nov 3, 2012
    Posts:
    182
    Hi, just bought Magica cloth and I'm having difficulty with point selection process. For some reason the selection of point selection works the first time I try it. But in subsequent attempts, it just does not seem to work. Red stays red, green stays green no matter how and where I drag. Is there an alternative way to assigning point types? This is very frustrating. I have to restart the whole Unity editor every time I need to change these points.
     
  18. Mikekan13

    Mikekan13

    Joined:
    May 30, 2015
    Posts:
    90
  19. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    Many users have commented on the difficulty of selecting points.
    Therefore, I would like to improve it somehow within this year.

    However, your symptoms seem to be another glitch.
    Does it mean that even if I follow the guide below and select a point, it disappears?
    https://magicasoft.jp/en/bonecloth-start-2/
     
  20. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
  21. taylank

    taylank

    Joined:
    Nov 3, 2012
    Posts:
    182
    The points are still visible, but they stop being interactable at some point, and become unresponsive to mouse drag events. I strongly suspect there is something wrong with Unity's handling of scene view mouse events, as I've had the same problem with Unity's own cloth vertex painting system not responding to drag events. So if there was an alternative way of assigning behaviour to those points, that'd be much welcome.
     
  22. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    Thank you for the explanation.
    I think this is likely to be a bug.
    Are there any steps to make this situation happen?

    Another way to set the point selection is to write the point information in color on the texture and reflect it.
    Unfortunately, implementing this method requires a lot of man-hours and cannot be done immediately.
     
  23. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    429
    hi @hoshos thanks for this amazing asset! One question though: how it's going with the separate axis rotation clamp for bone rotation? I've seen that it is still an issue and I am wondering if it is something that you are actively working on?

    Or maybe there is another way to do something like hinge joint (using bone transform) for the human character?
     
  24. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    I remember the individual clamping function of the XYZ axes.
    It is also included in the roadmap.
    However, this year as well, there are many functions that have been implemented with priority, so it has been postponed.
    Therefore, it seems that it will still take some time to implement.
    Please understand that I am an individual developer and it takes a long time to implement.
     
  25. spiderspy

    spiderspy

    Joined:
    Aug 1, 2013
    Posts:
    16
    Which algorithm is using jobs more? And what way would be best to reduce the number of jobs needed per frame? We are using cloth mesh a lot. Jobs and burst are not optimized for certain platforms.
     
  26. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    MeshCloth is certainly a heavy process.
    Probably dozens of times more load than BoneCloth.
    MeshCloth directly modifies the vertices of the skinning mesh.
    In addition, MagicaCloth works with a virtual mesh called Virtual Deformer, which is a collection of multiple meshes.
    For this reason, MeshCloth will have the following four high-load processes at once.

    (1) Vertex skinning processing by Virtual Deformer
    (2) MeshCloth cloth simulation
    (3) Reverse skinning of simulation results to the vertices of each mesh
    (4) Processing to write the final vertex information to the mesh

    Therefore, the load is inevitably high.
    Especially with Android and Nintendo Switch, the number of cores that can be used is about 2, which makes the situation worse.
    If the number of cores available is large, the load will be dramatically improved.
    Therefore, unfortunately, this load cannot be avoided when using MeshCloth.

    If the target terminal has a small number of CPU cores, it is desirable to avoid heavy use of MeshCloth, which also has a large number of vertices.
    Alternatively, it is desirable to significantly reduce the number of vertices in the mesh in advance.
    Also, since BoneCloth is fast, please consider whether it is possible to operate without MeshCloth depending on the location.

    Finally, consider using Delay Unscaled Time, which simulates at render time.
    This can be done while rendering the cloth simulation, which can significantly reduce the processing load in some cases.
    https://magicasoft.jp/en/magica-cloth-physics-manager-2/
     
    spiderspy likes this.
  27. spiderspy

    spiderspy

    Joined:
    Aug 1, 2013
    Posts:
    16
    Thank you for the detailed response, I think I will remake my character to use BoneCloth after all.
     
    hoshos likes this.
  28. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Update: 1.12.2

    v1.12.2 has been released on the Asset Store!
    http://u3d.as/1Hzx

    Physics Manager now has an option to take advantage of Unity's new Mesh API.
    By using this function, the update speed of the mesh will be greatly improved.
    However, Unity 2021.2 or later is required.
    faster-write-1.jpg

    And one more
    Actually, the mesh information of RenderDeformer was not released correctly, causing a memory leak.
    It is a critical problem that the worst app crashes when creating and deleting characters with MagicaCloth for a long time.
    This has also been fixed in 1.12.2 this time.
    We apologize for the inconvenience.

    Release Note:
    Added: Added support for writing mesh vertex data using Unity's new Mesh API.
    This is available in the MagicaPhysicsManager's Faster Write option (default is ON)
    By using this function, the speed of writing data to the mesh will be significantly increased.
    However, this feature is only available on Unity 2021.2 and above.
    Added: Added an API to get all the Transforms used by the component.
    Added: Added an API that allows component Transform substitutions to be specified in the <Name, Transform> dictionary.
    Fixed: Fixed an issue where the clone mesh was not properly freed memory when destroying MagicaRenderDeformer.
    Improvement: Changed the coordinate base of the skinning mesh from the renderer Transform to the SkinnedMeshRenderer RootBone.

    https://magicasoft.jp/en/release-note-2/
     
  29. Shii

    Shii

    Joined:
    Nov 23, 2014
    Posts:
    31
    Is Magica Cloth performance of animating meshes close to native Unity Cloth in 1.12.2 update with new Mesh API?
     
  30. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    No, it's not that much optimization.
    However, it should be a great benefit, especially if you use a lot of MeshCloth components on your PC.
    The following profiler is a comparison of the writing speed when 51 sample Unity-Chans are displayed.
    FasterWrite-2.jpg
     
    Shii likes this.
  31. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    305
    Hello, I hope all has been great for you.

    Just following up, any update in the "olume Constraint and expresses realistic shaking by expanding and contracting volume" implementation?

    Thanks
     
  32. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello!
    It's a soft body.
    I've experimented with this once, but it didn't work very well, so it's still going to take some time.
    Currently, we are focusing on the work of large-scale version upgrade of Magica Cloth.
    This is probably Magica Cloth 2.
    Therefore, if the soft body function is included, it is probably Magica Cloth 2.
     
  33. WILEz1975

    WILEz1975

    Joined:
    Mar 23, 2013
    Posts:
    374
    Hi, sorry if I still bother you.
    I don't know if you remember my question, but I couldn't do as you suggested.

    Screenshot_1.jpg

    I have only one cloth in this transform, and I don't need to use a cycle.
    But I think I have not understood something.
    I'm not getting errors but nothing new happens.
    Could you by chance give me a code example on how to do it?
     
    Last edited: Jan 26, 2022
  34. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    I've created sample code to swap bones in MagicaCloth components, move colliders, and swap bones in SkinnedMeshRenderer.
    Swapping bones in MaigcaCloth is similar to SkinnedMeshRenderer, but it's easier to think of them separately.
    We also have a test package to test this code.
    You can download it from the following link.

    DressUpAPITest
    https://drive.google.com/file/d/1xehcFpaseImffHy2lCGMN3qbtWH_PP9k/view?usp=sharing

    This package uses Magica Cloth assets, so you must first have the latest Magica Cloth installed before you can test it.
    Open the DressUpAPITest scene in the MagicaClothTest / Test / DressUpAPITest folder.
    TagetAvatar is the target avatar for dressing up, and Summer is the dressing object for dressing up.
    The DressUpAPITest.cs attached to the Summer object is the sample coat.

    Note that this sample uses a new dress-up API, so it will only work with MagicaCloth v1.12.2 or later.
    Please note this point.

    Code (CSharp):
    1. using MagicaCloth;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class DressUpAPITest : MonoBehaviour
    6. {
    7.     /// <summary>
    8.     /// Top object of avatar to be dressed up
    9.     /// </summary>
    10.     public GameObject targetAvatar;
    11.  
    12.     void Start()
    13.     {
    14.         Equip();
    15.     }
    16.  
    17.     void Update()
    18.     {
    19.  
    20.     }
    21.  
    22.     void Equip()
    23.     {
    24.         Debug.Assert(targetAvatar);
    25.  
    26.         // Create all bone maps for the target avatar
    27.         var targetAvatarBoneMap = new Dictionary<string, Transform>();
    28.         foreach (Transform bone in targetAvatar.GetComponentsInChildren<Transform>())
    29.         {
    30.             if (targetAvatarBoneMap.ContainsKey(bone.name) == false)
    31.             {
    32.                 targetAvatarBoneMap.Add(bone.name, bone);
    33.             }
    34.         }
    35.  
    36.         // Moves this entire equipment under the target avatar.
    37.         transform.SetParent(targetAvatar.transform);
    38.         transform.localPosition = Vector3.zero;
    39.  
    40.         // Swap the bones of the SkinnedMeshRenderer.
    41.         // This is the same as Equipmentizer.cs
    42.         //var skinRendererBoneMap = new Dictionary<string, Transform>();
    43.         var skinRenderers = GetComponentsInChildren<SkinnedMeshRenderer>();
    44.         foreach (var sren in skinRenderers)
    45.         {
    46.             Transform[] newBones = new Transform[sren.bones.Length];
    47.  
    48.             for (int i = 0; i < sren.bones.Length; ++i)
    49.             {
    50.                 Transform bone = sren.bones[i];
    51.                 if (!targetAvatarBoneMap.TryGetValue(bone.name, out newBones[i]))
    52.                 {
    53.                     Debug.Log($"[SkinnedMeshRenderer({sren.name})] Unable to map bone [{bone.name}] to target skeleton.");
    54.                 }
    55.             }
    56.             sren.bones = newBones;
    57.         }
    58.  
    59.         // This is the end of Skinned Mesh Renderer support.
    60.         // From here, replace the bones of the MagicaCloth component.
    61.  
    62.         // Loop all MagicaCloth components
    63.         foreach (var magicaClothComponent in GetComponentsInChildren<CoreComponent>())
    64.         {
    65.             // Get all the bones you are currently using
    66.             Dictionary<string, Transform> useBoneMap = magicaClothComponent.GetUsedComponentBones();
    67.  
    68.             // New bone map to change to
    69.             Dictionary<string, Transform> newBoneMap = new Dictionary<string, Transform>();
    70.  
    71.             foreach (var boneName in useBoneMap.Keys)
    72.             {
    73.                 Transform replaceBone;
    74.                 if (targetAvatarBoneMap.TryGetValue(boneName, out replaceBone))
    75.                 {
    76.                     newBoneMap.Add(boneName, replaceBone);
    77.                 }
    78.                 else if (boneName != magicaClothComponent.name)
    79.                 {
    80.                     Debug.Log($"[MagicaClothComponent({magicaClothComponent.name})] Unable to map bone [{boneName}] to target skeleton.");
    81.                 }
    82.             }
    83.  
    84.             // Swap the bones of the MagicaCloth component
    85.             magicaClothComponent.ReplaceComponentBone(newBoneMap);
    86.         }
    87.  
    88.         // Finally replace all colliders with new avatars
    89.         var colliders = GetComponentsInChildren<ColliderComponent>();
    90.         foreach (var collider in colliders)
    91.         {
    92.             Transform parent = collider.transform.parent;
    93.             if (parent && targetAvatarBoneMap.ContainsKey(parent.name))
    94.             {
    95.                 Transform newParent = targetAvatarBoneMap[parent.name];
    96.                 collider.transform.SetParent(newParent);
    97.             }
    98.         }
    99.     }
    100. }
     
    mbussidk likes this.
  35. WILEz1975

    WILEz1975

    Joined:
    Mar 23, 2013
    Posts:
    374

    Thank you. I will update the MagicaCloth version.
    I have not updated until now for fear that all the settings of the multiple garments I have used so far in my project will be lost.

    EDIT
    After the update:
    Screenshot_4.jpg
    Even after Unity has restarted.
    Even after uninstalling MagicaCloth and installing again.
    It does not find dependencies under the Editor folders.
    Now I have to go back to the MagicaCloth old version.
    I use Unity 2020.1.0f1
     
    Last edited: Jan 29, 2022
  36. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    This is probably an update failure.
    Try a clean install.
    (Delete all MagicaCloth folders and then install)
     
  37. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Announcement

    Currently, when using Magica Cloth v1.12.2 in Unity 2021.2 or later + Meta Quest 2 development environment, there is a problem that the vertices of Mesh Cloth collapse.
    This is due to the [Faster Write] added in v1.12.2.
    https://magicasoft.jp/en/release-note-2/

    This option leverages the new Mesh API to write data to the mesh at high speed.
    Until the correction is completed, please turn off the [Faster Write] option of MagicaPhysicsManager as follows.

    quest2-fasterwrite-problem-2.jpg
     
  38. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Update: 1.12.3

    v1.12.3 has been released on the Asset Store!
    http://u3d.as/1Hzx

    Release Note:
    Fixed: Fixed an issue where the mesh Cloth vertices would collapse when the [Faster Write] option was enabled in Unity 2021.2 or later + Meta Quest 2 environment.

    https://magicasoft.jp/en/release-note-2/
     
  39. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,008
    Hi.

    I found that when the scale of parent transform is zero, MagicaBoneCloth does not work correctly until disable/re-enable MagicaBoneCloth component even the scale of parent is reverted to one. Is this intended behaviour?
     
  40. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    At the moment, scale 0 is not assumed as a specification.
    Therefore, there is a possibility that various internal problems have occurred.
    If possible, try setting the scale to 0.00001 instead of 0.
    If it is other than 0, the problem should be avoided.
     
    Kichang-Kim likes this.
  41. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    Hi after upgrading to unity 2021.2 I had some problems with some parts of my clothes.
    I updated Magica to latest version Version 1.12.3

    I clicked "Start Point Selection" and noticed that some points that should be movable are set to fixed.
    And some previously set to fixed are movable.

    I repair it and click "end point selection"

    After this I get an Error:
    "This mesh cloth is in a state error! Please Recreate the cloth data. Error (400): Cloth SelectionHashMismatch"

    After this I did clicked all the "create" buttons there are.
    But I always get similar result, during play mode some of my cloth points are set to fixed. (points in similar region)
     
    Last edited: Feb 15, 2022
  42. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    We apologize for the inconvenience.
    It is possible that this is some kind of glitch.
    However, I'm not sure what the cause is, as I haven't received any similar inquiries so far.
    Does this problem occur in all components?
    Or does it only happen with certain meshes?
     
  43. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    I have used only 3 cloth parts, And it is present in two of them so far.
    I was able to repair one by removing cloth component and adding a new one, and I had to set everything manually since it looks like when I copy component it will copy it with a hash numbers.
     
  44. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,068
    The bug is returning to me all the time.
    I even removed magica and installed again.

    It looks like this:
    I press create on magica mesh and i dont have an error.
    I start editing points press "end" and i got the error.
    On some meshes it finally started to work on some don't.

    Can i mash the "create" button on all this components (deformers etc) or the order is important ?
     
  45. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    This is most likely a bug.
    I would like to investigate this issue.
    So, if possible, can I borrow the model data (fbx)?
    If you have model data, you may be able to analyze it to determine the cause.
    If possible, please send it to my [Inbox] or [support@magicasoft.jp].
    (I also want to know a simple generation procedure)

    <postscript>
    It would be even better if there was a project that could be reproduced.
     
    Last edited: Feb 17, 2022
  46. athert

    athert

    Joined:
    Dec 31, 2012
    Posts:
    36
    Hellooo.
    After few months, i was assigned to investigate magica again so im just interested if there is any progress in resolving this performance issue or not.
    I will just quickly tell what our problem was.
    In our game, every NPC can have multiple parts of clothing. There is hundreds of NPCs that player can see but of course we will enable magica only for NPCs that are close enough for player to be visible. But there is issue that once clothing is "added" to particles (to be specific, to FixedChunkNativeArray, for example flagList), it will stay there until game will be restarted. We can disable or remove clothing but these arrays will be just bigger and bigger. We tested multiple times how big these arrays can be and multiples times we found ourself on 32k length only in 7 minutes of playing and magica will take 5ms even on Delay update.
    We are using older versions of magica and i notice that there is multiple updates but honestly we dont need any of new features, we just want to be able to use magica as it is right now but without these issues.
    Is there fix in these updates? We dont want to update if there is no solution for us but if its fixed already, we will gladly move to newer version.
    If there are no fixes for this issues. Can you tell us if there is something we can do? :/
    Thank you.
     
  47. SwenSVK

    SwenSVK

    Joined:
    Apr 3, 2020
    Posts:
    6
    Hello, I have swtiched my project from URP to HDRP and I cant get the magica cloth working. I use the same setting as in the URP (where it worked just like charm). I cant see any problem in the components, but the mesh is acting weird.
    I have burst, jobs, magica renderer in scene, all the components - RendererDerormer, VirtualDeformer and MeshCloth. I have also setup the moving / fix points correctly.

    Can you tell me what else I am missing. I literally copy pasted the character from URP project to HDRP project. Not working. Then I recreated the same from scratch in HDRP using the same setup as in URP. Not working.

    I also checked the demo scene and it seems that the Chan has the same problem. Can it be because of the HDRP Lit / HDRP Layered Lit shaders?

    Magica.png MagicaDemo.png MagicaMeshCloth.png MagicaRenderer.png MagicaVirtualDeformer.png
     
    Last edited: Feb 19, 2022
  48. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    First, this behavior is by design and normal.
    NativeArrays such as flagList are shared by all components.
    For example, if you have three cloth components of ABC, their data will be stored in an array.
    If the component of A is deleted, the area of A will be empty, but the size of the array will remain the same.
    When a new component of E is added, it will be added to the area where A was, but if not, the array will be expanded.
    The reason for this structure is that the extension of the array is very expensive.
    (For example, when packing data, it is necessary to replace multiple copies and references.)
    Therefore, the array may be expanded but not reduced.
    This structure is the same in the latest v1.12.3.
    Perhaps the cause of the load is not the size of the array, but simply the number of moving particles (vertices).
    The platform is unknown, but MeshCloth is particularly heavy, so if you use it a lot on iPhone and Android, the performance will drop.

    Currently available workarounds include:

    (1) Use Delayed Update
    https://magicasoft.jp/en/magica-cloth-physics-manager-2/
    I think you have already used this.

    (2) Set the culling mode to Reset / Pause
    https://magicasoft.jp/en/cullingsystem/
    By specifying culling, it is possible to stop the cloth component and improve performance when it is not drawn on the camera.

    (3) Set the high-speed write mode
    https://magicasoft.jp/en/magica-cloth-physics-manager-2/
    This is only available in the latest v1.12.3, but enabling this Faster Write may improve the writing speed of MeshCloth.

    Try testing the above features.
    We would like to make some improvements in the future to reduce the load on MeshCloth.
     
  49. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello.
    Sorry, this is probably a bug in Magica Cloth.
    Shaders don't matter.
    Specifically, it seems to be a problem of the fast write [Faster Write] option to the mesh added in v1.12.2.
    https://magicasoft.jp/en/magica-cloth-physics-manager-2/

    First, try updating Magica Cloth to the latest v1.12.3.
    https://magicasoft.jp/en/release-note-2/

    If that doesn't help, try turning off the Faster Write option.
    https://magicasoft.jp/en/magica-cloth-physics-manager-2/
     
  50. athert

    athert

    Joined:
    Dec 31, 2012
    Posts:
    36
    Hello.
    These workarounds are not possible for us because issue is not in moving particles, its really in size of these arrays (or code around it, i didnt look at it right deeper right now). We have multiple clothes that will increase sizes of these arrays and even if we remove them at once during testing and we will have only one single clothing visible (or not even cloth, boneSpring for example), it will still take 5ms. I think this issue is even easily reproducible. You just need to spawn your character with clothing for example thousand times at once and then remove it expect one (so magica will still calculate, there is check to see if at least one team is enabled). You will see that it will still take big performance hit even if there is "no clothing" at all.