[RELEASED] Magica Cloth

Hello.
If you want an older version, please contact support email or my InBox on this forum with the invoice number starting with IN on the purchase receipt PDF.
Please tell us the version you want at that time.
However, please note that we cannot basically support bug fixes other than the latest version.

support@magicasoft.jp

I’m investigating, but I still don’t know the cause.
Could you tell me about the following?

(1) Use of global collider
Is the IsGlobal flag on the collider that has the problem?

(2) Value of teamId when a problem occurs
Do you know the value of teamId when you have a problem and return on line 286 of ParticleComponent.CreateParticle ()?
Is it non-zero?

(3) Reuse of colliders
Does the collider call the API of AddCollider () many times?
So are you switching the same collider to different fabric components with AddCollider ()?

(4) Use of RemoveCollider () API
If possible, try removing the collider using the RemoveCollider () API before the cloth component is removed.
RemoveCollider () is an API paired with AddCollider ().
Does doing this solve the problem?

We have internally postponed this issue due to time constraints but here is some more information:

(1) The IsGlobal flag is not used on any of the colliders.

(2) The value of teamId when the problem occurs is non-zero.

(3) We have a total of 15 colliders that are all added via AddCollider() to a new Clothing piece. We are planning on reducing the amount used per Clothing piece since of course a Skirt does not need to use the collider for the Character’s head.

(4) I am not yet using RemoveCollider() to remove Colliders from a piece that is about to be replaced. I will try that once I get back to the issue!

Some additional info:
It only started happening once we added 2 Colliders for the Character’s head. So there might still be something wrong with our code on that end.
I will investigate (4) and give you an update once I know more.

Thank you for your time!

1 Like

Hi, a pre-purchase question, does this work on IOS platforms?
(eg, compiles fine with IL2CPP and through xcode)

Hello.
Yes, MagicaCloth works fine on iOS.
Basically, it can be used on all platforms except WebGL.
However, since mobile devices including Android have a low number of CPU cores, it is necessary to be a little careful when using a large amount of MeshCloth.
It consumes a lot of CPU resources to read and write the vertices of the mesh.
There is no problem with BoneCloth.

Hello, is there a way to make this work with the 2D animation package? I had the problem before where the bones move but the sprite doesn’t (I’m guessing that’s due to the moment Unity updates the sprites skin to be moved is either too soon or too late) or the sprite moves but flicker.

Hello.
First of all, Magica Cloth has not been verified to work with 2D animation package.
So I don’t know if it works.
And if something goes wrong, we have no plans to deal with it at this time.
However, if you can report what kind of problem occurs, if the cause is simple, we may be able to deal with it.

I’m not entirely sure what the problem is without looking at Magica Cloth’s code, is probably a timing issue. I can show you what happens:

This is with a BoneCloth with Update set as Normal. The bones move according to the parameters, so is almost working.
warpedseveralape

This is with the Update set as Unity Physics. The sprite moves this time but it tries to go back to the initial position making it flicker.
barrensmoggygazelle

Edit: I took a look at the code. From what I can get Magica Cloth updates the bone position after the LateUpdate but the SpriteSkin of 2D Package does ON the LateUpdate. So I’m guessing for SpriteSkin the Bones never moved.

Edit2: I embedded the packages and made the SpriteSkin update inside MagicaPhysicsManager.AfterLateUpdate. It works but I’m worried about performance, I’ll try to disable the LateUpdate calls so it doesn’t get made twice.

Thank you for the very easy-to-understand video.
This seems to be a Magica Cloth update timing issue.
By the way, the first setting is correct.
The second [Unity Physics] mode is not correct here as it is used when the update mode of Animator is set to [Animate Physics].
If it’s an update timing issue, you may be able to fix it with a few adjustments.
I’m going to investigate this issue.
We will report the results on the forum, so please take a moment.

As I said on my edit, I managed to get it working. I couldn’t do it without changing 2D Animation code, because it was the only way I saw due to all the classes and functions being sealed or internal, and also to prevent the sprite update from happening more than needed. So I embedded(as in I made a local copy), both packages and made it so the update of SpriteSkinComposite happened inside the AfterLateUpdate(or PostLateUpdate) of MagicaPhysicsManager.
Now, I know that means the skin is getting updated as many times as the physics, but, both systems are using Burst so performance seems to be ok, my game won’t have too many physics enabled characters on the same scene anyways.

Quick demo with bad rigging:
zealousgraybronco

Anyways, if you find a better way please let me know. I’m leaving a positive review soon!

Hello.
The cause has been roughly identified.
All sprite transformations in the 2D Animation Package seem to be done with LateUpdate ().
However, the default update location for MagicaCloth is after LateUpdate (). (Red mark)
In this case, nothing happens because the sprite has already been deformed.
The solution is to update MagicaCloth before LateUpdate (). (Blue mark)

8052416--1039427--2D_Animation-1.jpg

I made an extension that allows you to choose the update location to fix this issue.
This version will be v1.12.5.preview1.
I’ll send it to your [In Box] so can you test it?

Hello,
Thank you for the great addon!

I am trying to make the pants move in a realistic way, but I always get ā€œtearingā€ and the pants do not handle stretching well. I tried to make some points fixed, but that stops tearing in one part and create new tears in other parts.


Is there any way to solve this?
(Note: I am using magica colliders for the legs, and they behave correctly).

Also, are there any presets for pants and shirts (i.e. male clothes other than Unity-chan’s)?

Thank you!

Hello.
Costumes that stick to your body may be a little difficult, but the following settings may help.

(1) Clamp Position
You can limit the distance that particles can move from the origin by setting the Clamp Position.
This avoids the problem that the clothes that are in close contact with each other are greatly displaced.
https://magicasoft.jp/en/paramater-clamp-position-2/

(2) Penetration
You can limit the range in which particles can move by using the [Penetration] function.
See the following guide for details.
https://magicasoft.jp/en/prevent-penetration-2/

As for presets, we do not have close-fitting clothes at this time because it is difficult to control.
Thank you.

1 Like

Thank you! I will try your suggestions.

As you can see in the above picture, when the upper part of the pants (below the belt) is stretched, it breaks. Is there any way (using Magica or 3D Modelling) to make the cloth stretch normally without breaking?

Thank you very much!

MagicaCloth does not have a tearing function, so basically it can stretch but not tear.
Therefore, the cause is not well understood.
Perhaps the original mesh triangle is already separated to the left and right.
In that case, try creating a simulation mesh by increasing the value of the vertex reduction of VirtualDeformer a little.
This will combine the closest vertices and eliminate the gap.

Is mesh collider not applicable? It is necessary for realistic clothing expression. please…

Hello there! Noob question here, Is there any example on how to get the Attached Cloth GameObject using this method :

public int AttachAvatarParts(GameObject avatarPartsPrefab, System.Action instanceAction = null)

Not sure exaclty how to subscribe to that action when declared like that.

When using the Mesh Cloth component which settings work best to achieve this result? Movement seems to simulate well but falling and hard landings where the force should be moving it more don’t seem to function as expected. I’ve tried fiddling with certain parts but can’t get it working too well, what section and values should I tweak?

Hello.
Currently mesh colliders are not available.
This is reserved because it is technically esoteric and not very practical in terms of performance.
There are many requests for this, but we have no plans to implement it at this time.

Hello.
I think the DressUpSample scene will be helpful for the dress-up API.
It can be found in MagicaCloth / Example (Can be deleted) / Scene / DressUpSample.

DressUpControl.cs is attached to the DressUpControl object in this scene.
If you look at this script, the AttachAvatarParts API is used internally.

1 Like