[RELEASED] MagicaCloth2 - Hybrid Cloth Simulation

Hello.
I watched the video.
It certainly looks like there is an inconsistency in the simulation.
If possible, please provide the project in question.
It would be very helpful if you have a project.
If you would like to send a project, please send me a DM.
You can send a DM by clicking on my account and selecting “Message”.

So I am using UMA for my characters. With my main character if I change their outfit Magica Cloth stops working. Now this is probably due to how UMA creates the mesh.

So…Question

I want to be able to call BuildAndRun after I have updated the character, but how can I reset MagicaCloth so that BuildAndRun works for the second time

Calling ResetCloth(false) did not work.

Hello.
I think UMA is a dress-up system.
If you want to transfer MagicaCloth to another skeleton, you need to swap the internal bones.
This method is described in the following document.
First, check if there are any problems with this.
https://magicasoft.jp/en/mc2_dressup/

Second, ResetCloth() resets an already running simulation to its initial state, but does not initialize everything.
In MagicaCloth, you cannot reinitialize once it has entered the running state.

However, you can manually call BuildAndRun().
First, in MagicaCloth, construction begins with MonoBehaviour’s Start().
Therefore, call DisableAutoBuild() to stop automatic construction before MagicaCloth’s Start() is called.
https://magicasoft.jp/en/mc2_api_magicacloth/#DisableAutoBuild

Then, when you have completed setting up your character, call BuildAndRun() manually.
https://magicasoft.jp/en/mc2_api_magicacloth/#BuildAndRun

You can now launch MagicaCloth at any time.
However, please note that the character’s pose must be the same when editing and when running MagicaCloth.
The character’s coordinates are irrelevant.
Otherwise, vertex painting and other things will shift and cause malfunctions.
We won’t know whether this works well with UMA until we test it.

:sparkles:Announcement :sparkles:
Hello everyone!
I will be away from home for a few days.
Therefore, I will not be able to respond to inquiries.
I will probably be back on 10/7.

I have it working with UMA. The problem starts when you change the characters outfit. That causes UMA to regenerate the mesh, which in turn causes MagicaCloth to lose it mind. So, I was looking at how to do a reset after a change.

No worries. I should be able to destroy the original magicacloth object and then recreate it. I was just hoping for a more elegant solution.

Thanks
Jeff

Hello,

I am aware that MagicaCloth2 is designed to be framerate-independent. However, when I test the cloth simulation at very low framerates, I find significant differences in simulation output. I test by setting Time.maxDeltaTime and MagicaManager’s MaxSimulationCountPerFrame to 999. Then, I use MovePosition to move a kinematic rigidbody in a circle in FixedUpdate with no interpolation. I have a MagicaCloth as a child of that rigidbody which has the update mode set to Unity Physics. From there, I set the Application.targetFramerate with VSyncCount at 0 to change framerate.

With this setup, framerates ranging from 8 to 2 cause moderate to extreme differences in the simulations results, with a framerate of 2 making the cloth almost be at a completely reverse rotation from what I would expect. Now, the reason my testing is so extreme is because I noticed framerate affecting the cloth at even 20 FPS when it was on an animator that is set to Animate Physics, and I decided to stress test to see if something was wrong. I would expect that a fixed simulation would have the same output if no simulations are being skipped, but here I can see that there are some discrepancies. I think the differences are more noticeable when the movements of the parent object are less uniform. I have also triple-checked that my setup is correct, and that I am using default MagicaCloth settings besides the settings I mentioned. Is this a known issue / limitation?

I see, I roughly understand the situation.
One thing I can say is that, as mentioned earlier, the MagiaCloth component does nothing until MonoBehaviour’s Start() is called.
Therefore, you should be able to reconfigure the component during that time.
However, it’s hard to say what the actual problem is without seeing the project.
If the problem persists, please contact us again.

Hello.
This is a known issue.
MagicaCloth cannot guarantee operation at extremely low frame rates.
There are two main reasons for this.

(1)Performance of interpolation calculation
The effect of inertia is calculated internally based on the character’s movement and rotation speed.
This is calculated from the difference between the character’s position and rotation in the previous frame and the current frame.
For this reason, if the time between frames is long, the calculation of rotation can go wrong.
For example, if there are 2 frames per second, one frame is 0.5 seconds.
If the character is rotating at high speed, it may rotate more than 180 degrees in this 0.5 seconds.
For example, a rotation of 270 degrees to the right.
In this case, the calculation will determine that it is 90 degrees to the left, not 270 degrees to the right.
This is because the internal system only looks at simple interpolation to the shortest distance.
In this case, the inertia will be strange.

(2)Performance of future prediction
In MagicaCloth, the final vertex positions visible to the eye will differ from the actual simulation results.
The final display position is calculated by interpolating the position and velocity from the simulation results for the frame to be displayed.
This is called future prediction.
Without this calculation, the simulation results would be displayed with extremely jerky movement.
The lower the frame rate, the less accurate this prediction becomes.

As you can see, various problems can occur at low frame rates.
The recommended frame rate is 30 fps or higher.