Search Unity

[RELEASED] MagicaCloth2 - Hybrid Cloth Simulation

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

  1. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    Thanks for the video!
    I am relieved to see that it seems to be working as designed.
    We will be implementing the wind system in April, so stay tuned!
     
  2. Faisal_Azizi_

    Faisal_Azizi_

    Joined:
    Feb 5, 2021
    Posts:
    25
    So they reason i need this feature is because. I am creating my own implementation of the lod for my magica cloth objects. so for example if i have an objects lets say a skirt, when i create LODs for it i am also attaching the magica cloth component to the child objects where the lods reside. so LOD0, LOD1, LOD2 all will have their own magica cloth component. Everything else works i am able to transfer all the configurations automatically when i generate the lods using my own system. the only thing that does not work is i am trying to transfer the selection points for that object. so i want it so that i iterate through the points in the LOD0 and see if LOD1 has vertex points that are close to LOD0 and change their state accordingly. In my system all of the lods and magica cloth are attached and generated automatically.
     
  3. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Vertex attributes can also be specified by providing a paint texture.
    https://magicasoft.jp/en/mc2_vertexpaint/#Vertex_painting_with_textures

    Is this method not feasible?
     
  4. CarmenXero96

    CarmenXero96

    Joined:
    Mar 25, 2013
    Posts:
    17
    Thank you for your reply, this helped me a lot, I ended up using the Plane collider idea and it worked out very well.

    Another question I had, is it possible to disable the simulation on specific bones via scripting or at least specific root bones?

    We have 8 locks of hair, each with 3 bones each, giving us 24 total bones under a single root. When using Magica Cloth for simulation, it works super well. However, we want to use custom physics forces for one of the locks of hair for a game mechanic. When using our custom system, with Magica disabled, it works exactly as we need to. However, with Magica enabled, the combined movements cause many problems.

    We are looking to just disable Magica when the player is interacting with the hair lock.

    We did try making another Magica Cloth component and assigning it just the hair lock for its root bones and it works well enough, but its a little annoying when we make adjustments to the whole system and have to also do it to that separate one.
     
  5. Faisal_Azizi_

    Faisal_Azizi_

    Joined:
    Feb 5, 2021
    Posts:
    25
    It does work but automating the process has some rough edges specially with respect to vertexes that are along the edges of the texture. I would much appreciate it if i am able to have control over points using code. The second problem is purely of convenience since its very hard to make changes and have them be shown automatically and you have to use a third party software as well. eventually we will make use of the paint map for alot of the models but for some we need to be able to modify the points.
     
  6. utceylan

    utceylan

    Joined:
    Jan 14, 2018
    Posts:
    5
    Hello,
    I am currently trying to update an project from Magica 1 to Magica 2.

    We used to use the global setting on collusion detection but apparently it is no longer available and there is a 32 collider limit on colider list on magica cloth. Is there a way to bypass this limit even if we sacrifice some performance?
     
  7. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    It is possible to enable or disable the entire set of registered bones by manipulating the component's Enabled.
    Unfortunately, it is not possible to disable a specific bone only.
     
  8. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    Thank you for the explanation.
    It is relatively easy to publish the vertex paint data externally.
    I will change this to publish at a later date.

    However, the data is not simple.
    You are probably imagining a vertex index and attribute pair, but that is not the case.
    It is actually recorded as a pair of vertex coordinates and attributes.
    And the coordinates are local coordinates from the cloth component Transform.
    Therefore, when actually setting up the mesh, the vertex coordinates of the mesh must be converted to the local coordinates of the cloth component before it can be stored.
    This can be quite demanding to run from C# at runtime.
    Therefore, it may be tough without using Burst.
    The reason we don't record by vertex index is that the index changes frequently depending on the mesh import options.

    As you can see, there is a lot of work involved in practice.
    So setting up the data is not that easy.
    Please keep this in mind.

    We are currently working on the wind system, so this public setup will be available sometime in May.
     
  9. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    First of all, Ver2 is not compatible with Ver1 and is a destructive update.
    Therefore, please be aware that Ver2 is a different asset from Ver1.
    Therefore, some restrictions have been loosened and some have been tightened.
    The maximum number of colliders is 32 to allow for frequent addition and removal of colliders at low cost.
    Therefore, there are currently no plans to extend this limit.

    The global collider setting is gone.
    The global collider was implemented in a very specific way.
    Therefore, performance was not good.
    In Ver2, they can be easily added and removed from scripts as described above.
    For example, when the character approaches an object, a collider is added, and when the character leaves the object, the collider is removed.
    Please consider this method.
    https://magicasoft.jp/en/mc2_runtimechanges/
     
  10. Faisal_Azizi_

    Faisal_Azizi_

    Joined:
    Feb 5, 2021
    Posts:
    25
    Hello thank you for the response, I was able to carry over the points that were assigned in base LOD0 and works exactly how i wanted it to be. Basically i was able to get the selection points from SerializedData2 to all the child components.
     
  11. Faisal_Azizi_

    Faisal_Azizi_

    Joined:
    Feb 5, 2021
    Posts:
    25
    Can we have the the property "Simple Distance" inside the reduction have a maximum of 0.2? currently its locked at 0.1 that would be much appreciated.
     
  12. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Oh wow!
    Since serializeData2 is private, I wonder how it was accessed.

    [Simple Distance] is certainly a little too low, so I will extend it to 0.2 in the next version.
    Added to task.
     
  13. Faisal_Azizi_

    Faisal_Azizi_

    Joined:
    Feb 5, 2021
    Posts:
    25
    Code (CSharp):
    1. magicaClothList[m].GetSerializeData2().selectionData = sData2;
    Its pretty straight forward i didn't have to change much.
     
  14. Faisal_Azizi_

    Faisal_Azizi_

    Joined:
    Feb 5, 2021
    Posts:
    25
    "You are probably imagining a vertex index and attribute pair, but that is not the case.
    It is actually recorded as a pair of vertex coordinates and attributes.
    And the coordinates are local coordinates from the cloth component Transform." This was actually the key to solve my problem as this is exactly what i needed. I want the positions to be paired rather than the index itself. And because of this the solution was automatic
     
  15. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    I forgot that GetSerializeData2() existed.
    Certainly this gives you access to vertex paint data.
    This information will be documented at a later date.

    By the way, in actual processing, the vertices of the proxy mesh are connected to their closest vertex attribute.
    Therefore, it is possible to connect even if the vertex attribute coordinates and the proxy mesh vertex coordinates are different.
    As a result, it is okay if the shape of the proxy mesh changes slightly.
    This might be a hint when dealing with LODs.
     
  16. Faisal_Azizi_

    Faisal_Azizi_

    Joined:
    Feb 5, 2021
    Posts:
    25
    Oh absolutely. I am really happy the way you approached the the vertices of the proxy mesh and as a result of that i am able to make a functioning LOD system. The way i see it it should be easy enough to integrate this into the tool. just by carrying all the points did the trick and in my opinion works better than the paint map as for my requirements for some models.
    Overall i am really enjoying working with the tool.
     
  17. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    The format of vertex attributes will be documented at a later date.
    Also, integration with Unity's LOD system is a future research topic.
    We all know that LOD is important.
    I would like to try it once when I have some time.
     
    Faisal_Azizi_ likes this.
  18. AetherMFP

    AetherMFP

    Joined:
    Feb 11, 2022
    Posts:
    39
    any update on adding teleport reset? from v1
     
  19. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    Unfortunately, V2 doesn't have teleport-related features yet.
    However, it has already been added as a work item as it has been requested by several other users.
    We are currently developing a wind system and will implement it later.
     
  20. TylkoDemon

    TylkoDemon

    Joined:
    Feb 28, 2013
    Posts:
    6
    Hello,
    I've been using Magica Cloth for quite some time and decided to upgrade to Magica Cloth 2 even thou there is no wind feature yet.
    Unfortunately, it didn't work out of the box in my project but worked great on a new one.
    After some debugging, I found out that one of my systems was using
    var playerLoop = PlayerLoop.GetDefaultPlayerLoop();

    instead of
    var playerLoop = PlayerLoop.GetCurrentPlayerLoop();

    with overrode the Magica Cloth's events, and caused it to not work.

    It would be a good idea to make some sanity checks for Development Builds/Editor if player loops are properly updated.
    Right now, if the user imports this package to a project that has other systems that does not handle PlayerLoop well, it silently gets broken.

    So that's it, I've just wanted to share my little discovery +, to be honest, I just found out that there is something like
    GetCurrentPlayerLoop()
    so that's kinda cool.

    Other than that, the asset works great. Good work.
     
    Last edited: Apr 30, 2023
    YoheiW and hopeful like this.
  21. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    Thank you for your report!
    The problem is quite understandable.
    Actually, in Ver1, the status of PlayerLoop was checked each time the frame was updated, and if it was overwritten, it was set again.
    However, this process itself is a little heavy, so it was removed in Ver2.
    In order not to cause similar problems, it may be necessary to check regularly as well as Ver1.
    I will consider it later.
     
  22. utceylan

    utceylan

    Joined:
    Jan 14, 2018
    Posts:
    5
    Hello,

    We are using magica cloth for jiggle physics on some characters. After the physic simulation we are copying the position and rotation of the bones to the clothing she is wearing but it is not working.

    We also have an script that measures distance for an object that uses magica cloth component however, while the bones move it still measures from the original position of the bone and not the current one. We tried to run the script at the bottom of the script order or on late update but still nothing.

    Do you have any advice?

    Thank you.
     
    Last edited: Apr 14, 2023
    SocialFuture likes this.
  23. Faisal_Azizi_

    Faisal_Azizi_

    Joined:
    Feb 5, 2021
    Posts:
    25
    How to have the cloth not be effected by the character's velocity for example when the character is moving fast. when the character is moving fast, the movement of cloth and bone cloth becomes jerky and choppy.
     
  24. ncorns

    ncorns

    Joined:
    Jan 15, 2017
    Posts:
    10
    Hi, I currently have a single mesh with an atlas making around 5.4ms for 16 models on screen at a time without cloth. When adding cloth using default settings, CPU usage spikes to 16.4ms and framerate drops massively. Am I expecting too much or am i configuring something wrong? Is this package aimed at "main character" cloth mechanics only? Am I approaching this wrong and the fabric should be used on a smaller seperate / isolated mesh rendered on its own rather than referencing the entire single character model skin renderer ?

    Image attached of example, only contains 2 colliders, cloth is "point" with default settings. You can see the before/after stats when adding the cloth to 16 models on screen.

    After reading the documentation, it seems that "point" mode without self collision and without mutual collision should be the 2nd fastest configuration next to back stop.

    Edit: I appreciate this is in the editor, but i've disabled all of the options as recommended in the documentation for JIT/DOT. I'm seeing the same results at runtime.
     

    Attached Files:

    Last edited: Apr 14, 2023
  25. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    I think you are probably using BoneCloth.
    MagicaCloth's Transform control is a little special, and the Transform posture is reset to the original posture at the start of the frame.
    Therefore, even if you get the Transform posture with Update() etc., you cannot get the simulation result.
    Please understand that this process is absolutely necessary.

    If you want to get the post-simulation transform pose, you need to get it before the simulation is complete and rendered.
    The simulation will run after LateUpdate() and before rendering.
    https://docs.unity3d.com/2021.3/Documentation/Manual/ExecutionOrder.html

    There are two ways to do this.

    (1) Using WaitForEndOfFrame
    WaitForEndOfFrame allows a script to be interrupted after rendering.
    However, keep in mind that rendering has already completed at this point.
    https://docs.unity3d.com/2021.3/Documentation/ScriptReference/WaitForEndOfFrame.html

    (2) Using OnPostSimulation
    MagicaManager provides OnPostSimulation as a post-simulation event.
    By using this event, it is possible to interrupt processing after simulation and before rendering.
    https://magicasoft.jp/en/mc2_api_magicamanager/#OnPostSimulation
     
  26. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    First, check at what update timing the character is moving.
    They are Update()/LateUpdate() and FixedUpdate().

    If the character's movement or animation is done with FixedUpdate(), the update timing of the cloth simulation should also be adjusted accordingly.
    This can be specified in the component's UpdateMode.
    https://magicasoft.jp/en/mc2_magicacloth_updatemode/

    Make sure this setting is correct first.
    Failure to do so will result in erratic vibrations in the simulation.

    Secondly, inertia settings are available to reduce the effect of the character's world movement.
    It is also possible to completely ignore character movement by changing the inertia parameter.
    https://magicasoft.jp/en/mc2_magicacloth_inertia/
     
    Faisal_Azizi_ likes this.
  27. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    First, make sure Burst compilation is working properly.
    Is Jobs/Burst/Enable Compilation checked as follows?
    If not, please set it to ON.
    burst-1.jpg
     
  28. ncorns

    ncorns

    Joined:
    Jan 15, 2017
    Posts:
    10
    Thanks for the quick response, this was already set to ON. i have noticed through more testing that the performance is better when you use a smaller seperate mesh although this doesn't help for situations where you have a single model for your character. I did another performance test vs unity cloth for 16 simple models but unfortunately there was still a large drop in FPS at runtime when using magica cloth 2.
     

    Attached Files:

  29. Faisal_Azizi_

    Faisal_Azizi_

    Joined:
    Feb 5, 2021
    Posts:
    25
    Hello, Thank you for the response! The solutions you mentioned worked for me. I had to set the update to physics update and tweaked some values with the inertia and it works now.
     
    hoshos likes this.
  30. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Yes, your performance metrics are correct.
    Unfortunately MeshCloth does not perform as well as UnityCloth.
    There is a reason for this though.

    This is because MagicaCloth's MeshCloth has a large additional task of writing the simulation results back to the vertices.
    With MeshCloth, the simulation is performed with a proxy mesh that combines multiple render meshes into one and reduces vertices.
    Advantages of proxy mesh are:

    • If you use the render mesh as it is, the number of vertices will be too large and the simulation load will be enormous.
      (It is not uncommon for even simple-looking meshes to have more than 10,000 vertices.)

    • Triangular connection structures are largely unsuitable for simulation
    • There are many cases where the mesh is divided for convenience of expression
      (Example: Split to separate the material for the back and front of the skirt, etc.)

    And this is important, but with MeshCloth there is a large additional work of writing the simulation results of this proxy mesh back to the render mesh.
    This is the task of reverse skinning the proxy mesh vertex coordinates back to the original render mesh.
    This is not in UnityCloth.
    This is because there is no concept of proxy mesh in UnityCloth.

    In addition, there is also work to write the result to Unity's Mesh class.
    Writing to the Mesh class can only be executed on the main thread, so parallel processing is not possible.
    In UnityCloth, this writing process is built into the engine, so it seems to run very fast.
    (This is my speculation as the internal processing is a black box)

    These two tasks are very heavy and sometimes take longer than the cloth simulation time.
    This is why it performs worse than UnityCloth.

    I'm looking to see if I can somehow resolve this issue.
    Please understand the reason for this.
     
    Last edited: Apr 16, 2023
  31. ncorns

    ncorns

    Joined:
    Jan 15, 2017
    Posts:
    10
    Thanks for in depth explanation - it sounds like I will need to use this cautiously and in the right situations (i.e. magicacloth for close up and primary models). I hope you find success in improving performance where possible. From my understanding. I have for the moment managed to use bone cloth instead on some models and it gives a relatively similar look to what i need but with really good performance.
     
    hoshos likes this.
  32. TylkoDemon

    TylkoDemon

    Joined:
    Feb 28, 2013
    Posts:
    6
    I actually have some more questions that are related to the performance as well, and it is about 'culling' the cloth physics.

    The concept is pretty basic: Only Player, and depending on the user settings, only X amount of closest characters would have the cloth simulation.

    The issue is, that when the object gets spawned without any simulation, everything would be in its default position (just like the UnityCHanKAGURA's hair and cloth are before you enter the PlayMode).

    I'm wondering how would you guys handle such cases or if there is another way, like reducing the frequency of the simulation or invoking it via custom scripts, etc.

    Also, I'm currently debugging why is that, but for some awesome reason, burst stopped working with Magica Cloth in standalone builds. And of course, it works fine inside the editor (because of course it is....) So if you had similar issues with Burst, I will gladly use your help.
     
    Last edited: Apr 20, 2023
  33. DumoeDss

    DumoeDss

    Joined:
    Feb 6, 2017
    Posts:
    7
    When backface outline is used, the backface mesh will be through-molded, like this
    QQ截图20230417153523.png
     
  34. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    A camera simulation culling system is in the planning stages.
    Actually, this function was in Ver1.
    The next video is from Ver1, but the same function will be included in Ver2.


    I am concerned about the phenomenon that Burst stops working at build time.
    Please let me know if you know how to reproduce it.
     
    TylkoDemon likes this.
  35. TylkoDemon

    TylkoDemon

    Joined:
    Feb 28, 2013
    Posts:
    6
    I remember that there was an option in ver1 where you could control the simulation of the cloth based on the distance to the selected transform, but I didn't know there was frustum-based culling. Nice!

    As for the issue with Burst. After trying many things like different unity versions, reimporting project from scratch, and using different build settings. I found out that Burst does not work with Magica Cloth if managed stripping level is set to High.

    I have confirmed that Burst would not work even on a new empty project with just Magica Cloth 2 and HDRP. The unity version I've used were 2022.2.14, 2022.2.15, 2023.1.0b12 and the scripting backend was Mono .NET Standard 2.1 On mono backend I don't really care that much about stripping because I'm using it mainly for debugging cause it compiles lightning fast, but when building with IL2CPP in master on lower stripping levels it might be a problem.
     
    Last edited: Apr 18, 2023
  36. TylkoDemon

    TylkoDemon

    Joined:
    Feb 28, 2013
    Posts:
    6
    And of course, to nobody's surprise, when Burst is not working the performance is bad.

    Stripping set to Medium (burst works)
    burst works on medium.png

    Stripping set to High (burst goes for a walk)
    burst does not work on high.png
     
  37. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    Several cases of this artifact have been reported, but the cause is not yet known.
    It's probably a vertex normal or vertex tangent problem.
    What is the name of this outline shader and where can I get it?
     
  38. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    Thank you for the information about the problem.
    I was able to reproduce the issue here.
    Unfortunately I don't know how to solve it.

    At first I thought it was an assembly exclusion problem due to Stripping, but it seems not.
    https://docs.unity3d.com/2022.2/Documentation/Manual/ManagedCodeStripping.html

    My tested link.xml looks like this:

    Code (CSharp):
    1. <linker>
    2. <assembly fullname="Unity.RenderPipelines.HighDefinition.Runtime" preserve="all"/>
    3. <assembly fullname="Unity.Collections" preserve="all" />
    4. <assembly fullname="Unity.Collections.Tests" preserve="all" />
    5. <assembly fullname="Unity.Burst.Tests" preserve="all" />
    6. <assembly fullname="Unity.Entities" preserve="all" />
    7. <assembly fullname="Unity.Entities.Hybrid" preserve="all" />
    8. <assembly fullname="Unity.Entities.Hybrid.Tests" preserve="all" />
    9. <assembly fullname="Unity.Entities.PerformanceTests" preserve="all" />
    10. <assembly fullname="Unity.Entities.Properties" preserve="all" />
    11. <assembly fullname="Unity.Entities.Properties.Tests" preserve="all" />
    12. <assembly fullname="Unity.Entities.StaticTypeRegistry" preserve="all" />
    13. <assembly fullname="Unity.Entities.Tests" preserve="all" />
    14. <assembly fullname="Unity.Entities.TestComponents" preserve="all" />
    15. <assembly fullname="Unity.Transforms" preserve="all" />
    16. <assembly fullname="Unity.Transforms.Hybrid" preserve="all" />
    17. <assembly fullname="Unity.Transforms.Tests" preserve="all" />
    18. <assembly fullname="Unity.Jobs" preserve="all" />
    19. <assembly fullname="Unity.Jobs.Tests" preserve="all" />
    20. <assembly fullname="Unity.ZeroPlayer" preserve="all" />
    21. <assembly fullname="Unity.ZeroJobs" preserve="all" />
    22. <assembly fullname="Unity.Rendering.Hybrid" preserve="all" />
    23. <assembly fullname="Unity.PerformanceTesting" preserve="all" />
    24. <assembly fullname="Unity.Mathematics" preserve="all" />
    25. <assembly fullname="Unity.Properties" preserve="all" />
    26. <assembly fullname="Unity.Burst" preserve="all" />
    27. <assembly fullname="Unity.Properties.Codegen" preserve="all" />
    28. <assembly fullname="Unity.Physics" preserve="all" />
    29. <assembly fullname="Unity.Physics.Authoring" preserve="all" />
    30. <assembly fullname="Unity.Physics.Samples" preserve="all" />
    31. <assembly fullname="MagicaClothV2" preserve="all"/>
    32. </linker>

    I honestly don't know why.
    Maybe it's a Unity bug.
    So sorry, but please try to build Stripping below Medium.
    I will report this issue as a bug report to Unity at a later date just in case.
     
    Last edited: Apr 19, 2023
    TylkoDemon likes this.
  39. MadStuntman

    MadStuntman

    Joined:
    Jun 27, 2019
    Posts:
    25
    It was your best idea to record video tutorials in 3840x2160 resolution. Thousands of users who are still using 1920x1080 resolution can confirm this. :D
     
  40. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    Video tutorials already support 4K.
    upload_2023-4-22_10-2-11.png
     
  41. MadStuntman

    MadStuntman

    Joined:
    Jun 27, 2019
    Posts:
    25
    I'm sorry, but it was irony :cool: If you watching video recorded in 3840x2160 resolution and max resolution of your display is 1920x1080, you can read nothing on Hierarchy, Project and Inspector window. Just click on link in my post above and you must get what I'm talking about :(
     
  42. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Okay, I understand why.
    You want the font size to be larger, not the resolution.
    I understand your request.
    However, I work alone and have no other staff.
    And there is a lot of work to be done.
    Therefore, it is difficult to respond immediately, sorry.
    I'll put this request on my task list.
     
  43. MadStuntman

    MadStuntman

    Joined:
    Jun 27, 2019
    Posts:
    25
    The fastest way to "fix" it is to switch to 1920x1080 resolution using your video card control panel. Another way is to set UI Scaling in Preferences to 200%. Since many developers now record their videos in 4K, I have to connect a 4K TV to read the text in the windows. For me personally, this is very inconvenient, but not critically, because you provide good documentation.

    P.S. Just bought Magica Cloth 2 (upgraded from Magica Cloth 1) and I can say it is AWESOME!
     
  44. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Thank you for your detailed advice!
    I want to keep the 4K image quality, so I would like to go with a method of setting the UI scaling to 200%.
    I will do that next time I make a video.
     
    MadStuntman likes this.
  45. Faisal_Azizi_

    Faisal_Azizi_

    Joined:
    Feb 5, 2021
    Posts:
    25
    Hello! The
    Code (CSharp):
    1. clothList[0].OnBuildComplete = OnBuildComplete;
    is not giving me any callback? is it supposed to be done differently?
     
  46. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    Just to be sure, I tested it and the event was successfully handled.
    Initialization of MagicaCloth is performed in Start(), so event registration must be done in Awake().
     
  47. Rand_D

    Rand_D

    Joined:
    Oct 24, 2017
    Posts:
    44
    Hi, i would like to ask how will it perform in mobile platform ?
     
  48. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    920
    Hello.
    All features are also available on mobile devices.
    However, there are some caveats regarding performance.
    See the following document for details.
    https://magicasoft.jp/en/mc2_performance/

    In summary, pay attention to MeshCloth and self-collision loads.
     
  49. YoheiW

    YoheiW

    Joined:
    Dec 17, 2016
    Posts:
    1
    Thanks to your post, the bug in my project is fixed. Thank you very much!
     
    TylkoDemon and hoshos like this.
  50. utceylan

    utceylan

    Joined:
    Jan 14, 2018
    Posts:
    5
    Hello,

    First of all thank you for your previous answers. They were really helpful.

    We have been getting about 91 to 161 errors "after" we press stop on unity editor.(no errors during runtime)

    Code (CSharp):
    1. Assertion failed
    2. UnityEngine.Debug:Assert (bool)
    3. MagicaCloth2.ColliderManager:RemoveCollider (MagicaCloth2.ColliderComponent,int) (at Assets/MagicaCloth2/Scripts/Core/Manager/Simulation/ColliderManager.cs:407)
    4. MagicaCloth2.ColliderComponent:OnDestroy () (at Assets/MagicaCloth2/Scripts/Core/Cloth/Collider/ColliderComponent.cs:140)
    5.  
    Code (CSharp):
    1. IndexOutOfRangeException: Index was outside the bounds of the array.
    2. (wrapper stelemref) System.Object.virt_stelemref_class(intptr,object)
    3. MagicaCloth2.ColliderManager.RemoveCollider (MagicaCloth2.ColliderComponent col, System.Int32 teamId) (at Assets/MagicaCloth2/Scripts/Core/Manager/Simulation/ColliderManager.cs:444)
    4. MagicaCloth2.ColliderComponent.OnDestroy () (at Assets/MagicaCloth2/Scripts/Core/Cloth/Collider/ColliderComponent.cs:140)


    Also we sometimes get this:

    Code (CSharp):
    1. Assertion failed
    2. UnityEngine.Debug:Assert (bool)
    3. MagicaCloth2.ColliderManager:RemoveCollider (MagicaCloth2.ColliderComponent,int) (at Assets/MagicaCloth2/Scripts/Core/Manager/Simulation/ColliderManager.cs:407)
    4. MagicaCloth2.ColliderComponent:OnDestroy () (at Assets/MagicaCloth2/Scripts/Core/Cloth/Collider/ColliderComponent.cs:140)
    5.  
    Code (CSharp):
    1. IndexOutOfRangeException: Index -1 is out of range of '512' Length.
    2. Unity.Collections.NativeArray`1[T].FailOutOfRangeError (System.Int32 index) (at <3ce5a037fce44b639132638672bf3c94>:0)
    3. Unity.Collections.NativeArray`1[T].CheckElementWriteAccess (System.Int32 index) (at <3ce5a037fce44b639132638672bf3c94>:0)
    4. Unity.Collections.NativeArray`1[T].set_Item (System.Int32 index, T value) (at <3ce5a037fce44b639132638672bf3c94>:0)
    5. MagicaCloth2.ExNativeArray`1[T].set_Item (System.Int32 index, T value) (at Assets/MagicaCloth2/Scripts/Core/Utility/NativeCollection/ExNativeArray.cs:485)
    6. MagicaCloth2.ColliderManager.RemoveCollider (MagicaCloth2.ColliderComponent col, System.Int32 teamId) (at Assets/MagicaCloth2/Scripts/Core/Manager/Simulation/ColliderManager.cs:419)
    7. MagicaCloth2.ColliderComponent.OnDestroy () (at Assets/MagicaCloth2/Scripts/Core/Cloth/Collider/ColliderComponent.cs:140)
    8.  
    It doesnt seem to effect anything in builds or runtime but it is driving us crazy for the last week. Any idea what we botched?

    Thank you for your time.
     
    Last edited: Apr 27, 2023