Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[RELEASED] Magica Cloth

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

  1. akihabarai965

    akihabarai965

    Joined:
    Oct 27, 2020
    Posts:
    6
    Thanks!
     
  2. Shii

    Shii

    Joined:
    Nov 23, 2014
    Posts:
    16
    Hi! In my game I have a component that must call a custom method after Magica Cloth done all it's operations.
    I was calling this method at the end of AfterLateUpdate() in MagicaPhysicsManager.cs but after 1.9.0 update I can't reference any outside scripts from Magica Cloth because asmdef preventing this.
    Is there another way of calling custom method after Magica Cloth done moving all transforms?
     
  3. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    hello.
    Certainly, since it corresponds to Unity Assembly Definition, such a demerit also occurs.
    However, please understand that Unity Assembly Definition should be dealt with as a library.
    It's a solution to the problem, but I think deleting the asmdef file will work as before.
    If you are in a hurry, try this method.
    And in the next version, we will be able to register callbacks before and after each calculation.
     
  4. Shii

    Shii

    Joined:
    Nov 23, 2014
    Posts:
    16
    Tha
    Thanks! Callback support sounds like a good solution.
     
  5. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    412
    Hi, which MagicaCloth system is best for making the feathers of wings follow the flow of the wing animation?

    upload_2021-1-29_11-22-30.png
     
  6. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    412
    Okay, not sure if BoneCloth is the best way to do it, but that's what I went with. I noticed some feathers tend to rotate and point in ways they shouldn't. How might I go about restricting it?

    @hoshos , what would you recommend for doing wings?

     
  7. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    As you say, BoneCloth is perfect for such wings.
    It seems that the wings move a lot when you move, so it may be good to limit it so that it does not move too much.
    There are two ways to do this.

    (1) Angle limit
    You can limit the maximum angle at which the wing bends by setting the Clamp Rotation parameter.

    https://magicasoft.jp/en/paramater-clamp-rotation-2/

    This makes it possible to suppress sudden changes in angle.

    (2) Movement / rotation effect
    https://magicasoft.jp/en/paramater-world-influence-2/

    You can set how much the movement and rotation of the main body are captured by [Movement Influence] and [Rotation Influence] of the [World Influence] parameter.
    By lowering this, it is possible to suppress the influence of movement.
    Also, by lowering [Max Move Speed], you can prevent a sudden force from being applied even if the character moves at high speed.
    When setting these values, be sure to set the bone that is the center of the [Influence Target] movement.
    In the case of wings, the chest bone is probably good.

    Finally, in the video, the wings appear to behave a bit strangely.
    Is the character moved by Update ()? Or is it done with FixedUpdate ()?
     
  8. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    412
    The character moves in FixedUpdate, good catch. I switched the update mode from Normal to Unity Physics.

    For easier testing, I turned off BoneCloth for one of the wings. I have a Clamp Rotation set to 30, but I still see the feathers 'spinning' or turning up/down when I move up and down. Do you know why they might be doing that even with a clamped rotation?



    If you have Discord, perhaps I could show you in realtime and that would be faster.
     
  9. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    This is certainly something wrong.
    FixedUpdate () It is correct to set the update mode to [Unity Physics] when moving.
    Do you have a collider?
    If so, try turning off the collider once.

    Also, try setting a simple [DynamicBoneStyle_PonyHair] etc. from the preset once.
    Does this change the movement?
    https://magicasoft.jp/en/magica-cloth-preset-2/

    If possible, could you please give me an image that shows the structure of the wing Transform?
    It looks like this:
    start-3.jpg

    Discord is not currently available.
    This is because I am Japanese and it takes time to translate and understand the content.
    I'm sorry, but please understand.
     
  10. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    412
    I started with the PonyHair preset but have made modifications. I found the PonyHair preset looked the best, but have been trying to figure out why the feathers spin when I move up and down.

    upload_2021-1-30_0-8-25.png

    upload_2021-1-30_0-10-22.png

    The wings do not have a collider.
     
  11. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Thank you for the detailed information.
    I found the wings are mesh connected.

    boneskirt2-9.jpg

    Mesh connections keep skirts and other structures strong, but wing structures like this one may not be suitable.
    Is this Mesh connection intended?
    If not, try reverting the Mesh connection back to the Line connection and testing.
     
  12. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    412
    It was originally set to Line. I changed it to Mesh to see if it would fix the spinning feathers problem, but it did not.

    Should I just send you a sample project so you can test it yourself?
     
  13. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    It would be helpful if you had sample data.
    Can I get it?
     
  14. BlankMauser

    BlankMauser

    Joined:
    Dec 10, 2013
    Posts:
    115
    Is there any way to have the cloth and bone simulations run, but only update them visually for the player during certain frames?

    I'm aiming for a stylized, choppy animation look.
     
  15. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    I'm sorry, I don't understand the question probably because of the translation.
    Could you explain a little more concretely?
    MagicaCloth supports pause and slow play of simulations, as well as distance or manual stop and resume.
    Perhaps it's an animation like Pingu?
     
  16. BlankMauser

    BlankMauser

    Joined:
    Dec 10, 2013
    Posts:
    115
    Yes! Just like that. Cloth that is only updated on certain frames.
     
  17. blk_tesoro

    blk_tesoro

    Joined:
    Jan 29, 2021
    Posts:
    1
    This is a very beginner question but I'm creating a game with lots of combat and I want to create swappable cloaks on my main character. I want to create maybe 3 different types of cloaks and be able to change the color or material of those 3 different types, is this possible. Like below, and also ones with no hood. How high is the learning curve for something like this and is it possible using Magica Cloth?

    Also, I apologize if this isn't the correct type of question to ask in this forum, just wanted to know before I make the purchase.

    Thanks, this system looks amazing btw!
     

    Attached Files:

  18. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    You'll probably play the animation frame-skipping, but MagicaCloth doesn't have a skip feature.
    Repeated pauses rarely update the simulation.
    So I'm sorry, but it's probably difficult to achieve.
     
  19. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    When implementing such a cloak, I think it is better to first make the cloak itself follow the human body by skinning.
    In other words, make sure your cloak doesn't collapse when you run or perform combat actions.
    On top of that, the Magica Cloth rocks the underside of the cloak for added realism.
    This is the most robust implementation.

    BoneCloth is available if the cloak is implemented by bones, otherwise MeshCloth is available.
    https://magicasoft.jp/en/bonecloth-start-2/
    https://magicasoft.jp/en/magicaclothmeshclothstart-2/

    The system has already been implemented for dressing up.
    See the following documentation:
    https://magicasoft.jp/en/dress-up-start-2/

    If dressing is implemented on a different system, all cloth-component bones will need to be manually replaced.
    This is possible with the following API:
    https://magicasoft.jp/en/corecomponent-2/

    However, doing this requires some programming knowledge.

    If you want to test before you buy, please let us know as there is an evaluation version.
    Thank you.
     
  20. geyluigi223

    geyluigi223

    Joined:
    Dec 14, 2020
    Posts:
    9
    Hi, does this package also work with Unity 2019 and above?
     
  21. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    Yes!
    MagicaCloth is available in all Unity 2018.4 and later versions.
     
  22. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Update: 1.9.1

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

    The problem that the angle limit is set by Clamp Rotation but it collapses when a strong force is applied has been improved.
    The left is the conventional one and the right is the one after the repair. (Limited angle is 0.0-15.0)
    ClampRotationImprovement.gif

    This can be adjusted with the new Velocity Limit parameter.
    It is also possible to reproduce the previous movement by setting it to 0.0.
    velocy_limit-1.jpg

    Release Note:
    Added: Added OnPreUpdate / OnPostUpdate events to PhysicsManager.
    Added: Added [Velocity Limit] parameter to Clamp Rotation.
    Clamp Rotation is stabilized by limiting the speed according to the moving speed.
    This can be set back to v1.9.0 or earlier by setting it to 0.0.
    Improvement: Fixed the problem that the angle limitation by Clamp Rotation is invalidated when a strong force is applied. [Velocity Limit] parameter.
    Fix: Fixed an issue where the Surface Penetration debug line was not displayed during execution.

    https://magicasoft.jp/en/release-note-2/
     
    Lymdun and Acissathar like this.
  23. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    136
    Hey guys, so I've been using MagicCloth flawlessly, but when I updated to the latest unity I now get this error when tring to create a new cloth mesh. Please see photo attached. Please keep in mind that when I up dated it was not working and giving me " the mesh cloth is in a state error - error 300"

    So I deleted the component and re-implemented it, and now I get this error attached How do i fix this? It was working perfectly before.


    Capture.PNG
     
  24. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    I want to investigate this issue but I can't find the error line.
    Could you please tell me the version of Unity and MagicaCloth before the update and the version of Unity and MagicaCloth after the update?
     
  25. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    136
    Latest versions of all. but I have some good news, I tried it two more times and it seems to be working now.
     
  26. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    136
    I do have another error showing:

    "Assembly for Assembly Definition File 'Assets/MagicaCloth/Scripts/Editor/MagicaCloth.Editor.asmdef' will not be compiled, because it has no scripts associated with it.
    UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,string[])"
     
  27. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Probably the effect of 1.9.0 corresponding to Unity Assembly Definition.
    Due to this correspondence, the directory structure has changed.
    Therefore, sorry to trouble you, but please delete all the folders of MagicaCloth and import the assets again (clean installation).
     
  28. QbAnYtO

    QbAnYtO

    Joined:
    Dec 18, 2016
    Posts:
    136
    Yes I did hat it it seems to fixed the issue

     
    hoshos likes this.
  29. xinoHITO1

    xinoHITO1

    Joined:
    Jul 2, 2012
    Posts:
    28
    Hello I'm having a similar issue as @QbAnYtO

    I downloaded the latest version of Magica Cloth in the Asset Store (1.9.1). I did a clean install in a new project. I'm using Unity 2019.4.8 LTS.

    I'm attempting to make the scarf on my character move with physics. I did the following steps:

    Added a MagicaRenderDeformer to the scarf mesh.
    Created a Magica Virtual Deformer and registered the scarf on the Render Deformer List.
    I clicked the Create button in the MagicaVirtualDeformer and it threw me an ArgumentOutOfRangeException.

    I'm attaching screenshots and also the complete call stack for the error.

    The model I'm using is Rigged using Mixamo's autorigging. It can play animations for Humanoid characters just fine. Is there a special requirement related to the bones or how the meshes are weighted?
     

    Attached Files:

  30. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    I have confirmed the error.
    There seems to be something wrong with the model.
    However, this error alone did not reveal the details of the problem.
    Would you please give me an FBX file for this character if possible to solve this problem?

    I received the same content in the support email, so it would be helpful if you could attach the FBX to the support email or send me a download link etc. to my [InBox] on this forum.
     
  31. AzanticGames

    AzanticGames

    Joined:
    Aug 4, 2013
    Posts:
    11
    hey there! Magica cloth is running smoothly without issues! Its an amzing extension to Unity! However, since upgrading to 2020.2 and also the newest Magica Cloth version, I am getting dozens of these
    Assets\MagicaCloth\Core\Deformer\Component\Editor\MagicaRenderDeformerInspector.cs(15,30): error CS0115: 'MagicaRenderDeformerInspector.OnInspectorGUI()': no suitable method found to override

    and hundreds of these
    Assets\MagicaCloth\Core\Utility\CustomEditor\Editor\EditorInspectorUtility.cs(1036,44): error CS0246: The type or namespace name 'SerializedProperty' could not be found (are you missing a using directive or an assembly reference?)

    errors when trying to build the project.
    Is there any solution to this at this point?
     
  32. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    Probably the effect of 1.9.0 corresponding to Unity Assembly Definition.
    The directory structure has changed in response to this.
    Try deleting the current MagicaCloth folder permanently and re-importing 1.9.1 again. (Clean installation)
     
  33. xinoHITO1

    xinoHITO1

    Joined:
    Jul 2, 2012
    Posts:
    28
    Thanks a lot for solving it! You were right! The FBX was somehow different and had broken references to the bones. Reimported it from another folder and it worked perfectly!

    Loving Magica Cloth!
     
  34. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    I was relieved that the problem was solved.
    If you have problems again, please contact us.
    Thank you.
     
  35. lyflike

    lyflike

    Joined:
    Dec 23, 2018
    Posts:
    4
    Hi,
    We are stuck in a collision issue on Android mobile build but working fine in Unity 2020.1 Editor, I am attaching the screenshots of front, side and back view screen shots from both editor and Android device
    Editor Screenshots:
    Editor_Front.PNG Editor_Back.PNG
    Android Screenshots:
    Android_Front.jpg Android_Side.jpg Android_Back.jpg
     
  36. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    MagicaCloth uses the [Mathematics] library for calculations, so there should be no difference on the platform.
    It is possible that the Android frame rate is extremely low compared to the PC.
    Do you know some FPS on the Android side?
    If the frame rate falls below 30 FPS, the simulation will be adversely affected.
    Also, this is a guideline, but Magica Cloth is unfortunately not a very advanced cloth simulation.
    Since this emphasizes speed, the number of iterations is smaller than that of general cloth simulation, and the calculation system is not very high.

    Also, there is currently no mesh collider that works with skinning.
    For this reason, it is not suitable for clothing that adheres to the skin as shown in the image.
    Please be aware of this point.

    Thank you.
     
  37. lyflike

    lyflike

    Joined:
    Dec 23, 2018
    Posts:
    4
    It was working before. I have tested that cloth simulate above 40 FPS. Please check below debug.

    SystemInfo CPU = ARM64 FP ASIMD AES, Cores = 8, Memory = 3739mb
    02-23 18:00:46.796 5444 5521 I Unity : Built from '2020.1/staging' branch, Version '2020.1.0b11 (de513167607b)', Build type 'Release', Scripting Backend 'mono', CPU 'armeabi-v7a', Stripping 'Disabled'
    02-23 18:00:48.458 5444 5521 E Unity : Unable to find lib_burst_0_0
    02-23 18:00:48.459 5444 5521 E Unity : Unable to find _burst_0_0
     
    Last edited: Feb 23, 2021
  38. tackor

    tackor

    Joined:
    Nov 24, 2017
    Posts:
    8
    I'm currently working on a cloak, like a superman's cloak, but I have a lot of attacks, need special animations to control the general movement, and I want to simulate the physics with Magicabonecloth, but the current version doesn't seem to deal with the combination of animation and Magicabonecloth properties, what should I do?
     
  39. tackor

    tackor

    Joined:
    Nov 24, 2017
    Posts:
    8
    Cloak effects such as <<Batman Arkham Knight>>, when the Batman Hit NPC
     
  40. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    Thank you for the detailed information.
    The frame rate is heavy, but if it is 40fps, it will behave like a PC.
    This may be a bug.
    Would you please package the prefab of this set up character if you like? (Or the smallest project)
    Then we will investigate here.
     
  41. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    Let me ask you a few questions.
    First, is the character's cloak animated?
    In other words, does the cloak deform to some extent due to animation even when Magica Cloth is not used?
     
  42. tackor

    tackor

    Joined:
    Nov 24, 2017
    Posts:
    8
    yes, the cloak deform to some extent due to animation even when Magica Cloth is not used.

    I wanted to animate the general movement of the cloak and then overlay the physics of the MagicaCloth with a value in between.For example, if this value of 1 is completely controlled by MagicaCloth, and this value of 0 is completely controlled by animation, in between, the fusion is based on weight
     
  43. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Thank you for the explanation.
    If the cloak is pre-animated, please note the following points when adjusting.

    (1) Turn off gravity
    Since the cloak is already animated, it is better to turn off or weaken the gravity.

    (2) Restore Rotation / Clamp Rotation
    https://magicasoft.jp/en/paramater-gravity-2/
    Both of these try to keep the shape in the initial state, so it may be better to set this parameter weakly as well.

    (3) World Influence
    https://magicasoft.jp/en/paramater-world-influence-2/
    Specifies how much the particles are affected when the character moves.
    You may want to first set the Influence Target to Chest and then set the Movement Influence to a lower value.
    This will prevent the cloak from deforming as the character moves.

    (4) Blend Weight
    Finally, the BlendWeight parameter allows you to change the blend ratio between the original animation and the cloth simulation.
    blendweight-1.jpg
    By using this, it is possible to turn off the cloth simulation during a specific motion such as during an attack.
    This parameter can be controlled from the following API:
    <float BlendWeight>
    https://magicasoft.jp/en/basecloth-2/
    Also, this blend ratio can be manipulated from Animation under the name [User Blend Weight].

    In the case of BoneCloth, it may be better to set and adjust [DynamicBoneStyle_LongHair] from the preset first.
     
  44. tackor

    tackor

    Joined:
    Nov 24, 2017
    Posts:
    8
    Thank you for your time, I also yesterday I made some operation, and the ability to cloak in the animation controls and MagicaCloth simulation control switch between cape, such as when I walk, cloak completely controlled by MagicaCloth, then attack, the effect of the animation and animation control cloak, but now there is a problem, is not very good at the end of the animation from the animation control by blendWeight cloak to MagicaCloth control.
     
  45. tackor

    tackor

    Joined:
    Nov 24, 2017
    Posts:
    8
    and I find code: basecloth.cs - > UpdateBlend() -> SetUserEnable(blend < 0.01f), that means I must set the blendWeight Less than 0.01 suddenly. But the cape effect I need should much more smooth. So, Is there a way I can use to change from MagicaCloth to Animation Control smoothly, and also smoothly from Animation Control to MagicaCloth
     
  46. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    The fade-in / fade-out of the original and cloth simulations is designed to be controlled by BlendWeight.
    Therefore, if BlendWeight is not functioning properly, there is a possibility of a malfunction.
    Let's investigate this issue a bit.
    Please give me some time.
     
  47. ikazrima

    ikazrima

    Joined:
    Feb 11, 2014
    Posts:
    312
    I tried assigning magica colliders to bone cloths at runtime, and got this error

    Code (CSharp):
    1. System.IndexOutOfRangeException: Index {0} is out of range of '{1}' Length.
    2. Thrown from job: MagicaCloth.PhysicsManagerParticleData.CopyBoneToParticleJob
    3. This Exception was thrown from a job compiled with Burst, which has limited exception support. Turn off burst (Jobs -> Burst -> Enable Compilation) to inspect full exceptions & stacktraces
    Here's my code

    Code (CSharp):
    1.  
    2.           foreach (Transform item in charaHair.GetComponentsInChildren<Transform>())
    3.            {
    4.                var magica = item.GetComponentInChildren<MagicaBoneCloth>();
    5.                magicaBone.Add(magica);
    6.            }
    7.  
    8.            foreach(var item in magicaBone)
    9.             {
    10.                foreach(var col in magicaCollider)
    11.                 {
    12.                    item.AddCollider(col);
    13.                 }
    14.             }
     
  48. ClementSchepens

    ClementSchepens

    Joined:
    May 27, 2020
    Posts:
    13
    Hi, I tried to limit the number of vertices (<600) but Magica Cloth is still using too much computer ressources. What are the best practices?
     
  49. spiderspy

    spiderspy

    Joined:
    Aug 1, 2013
    Posts:
    11
    Hi, first of all I like the result of the cloth sim.

    I have found two pretty severe saving bugs that messes things up for us.

    1. meshclothData and selectionData are saved inside the prefab and never removed and then when you save it again it creates another one. We need a way to clear the old ones away and it should have been saving over the initial one anyway. I will attach a snippet of the duplicate data being saved into my prefab with your cloth sim components. I am using meshcloth for our cape and cloak. I am using version v duplicate child prefab assets that are never cleared.PNG 1.9.1

    2. I do not think you are using the following events below correctly.

    PrefabUtility.prefabInstanceUpdated += OnPrefabInstanceUpdate;
    PrefabStage.prefabStageClosing += OnPrefabStageClosing;
    PrefabStage.prefabSaving += OnPrefabSaving;

    Because it keeps saving over my hero prefab asset when I am not even touching the prefab, this is very troubling for us, I think I might have to add some sort of save disabling bool to your code just to stop that from happening. These issues seems extra bad when I save inside a prefabscene. We have changes to this prefab in different scenes and those scene changes get saved to our prefab when we save the scene ect.

    Edit: It seems to be on row 344-352 in sharedataprefabextension.cs
    Where you save on else and else is being run more often that you think.
    PrefabUtility.SaveAsPrefabAssetAndConnect(instance, savePrefabPath, InteractionMode.AutomatedAction);

    such as when you reimport
     
    Last edited: Feb 25, 2021
  50. tackor

    tackor

    Joined:
    Nov 24, 2017
    Posts:
    8

    Don't worry. Take your time! and I tryed like this: boneCloth.UserBlendWeight = Mathf.Lerp(1, 0, Time.deltaTime), when it changed from Animation Control to MagicaCloth control, the cape will trembling.
     
unityunity