[About macOS Sequoia] (Updated October 22, 2024)
Live2D Cubism Editor 5.1.02 now supports macOS Sequoia.
Other Live2D Cubism products currently released are not guaranteed to work on macOS Sequoia.
Please refrain from upgrading macOS, as it may not operate properly.
Have automatic blinking/breathing.
Hello!
How do I make a character have automatic blinking and breathing? I have made a variant of the SDK's SimpleModel.cs and I use .mtn files to change the pose and show emotions, but after the animation is played, the character stays still and stiff. I'd be very thankful if someone could tell me how to have her appear alive with breathing and blinking.
0 ·
Comments
You can make automatic blinking and breathing the following code .
In the case of you , it is better not to use the EyeBlink function .
There was EyeBlink motion function in Live2D Animator .
I think that good to make motion with Live2D Animator !
My models look like this in the game:
Normal open (0.5)
Semi-open (aproximately 0.3)
Wide open (1.0)
As shown, the eye "open" parameter value depends on what .mtn is loaded into the model. I'm using the SimpleModel.cs as a base.
Perhaps I need to use a different base?
I test code is as follows . Please try to adjust the value .
Here is an eye parameter without any blinking:
This is what I am looking for:
This is what your code currently does.
So, the "eyeblink-down" works well. The problem is the "eyeblink-up". It needs to return to the "original" curve.
Is a way to achieve that?
If there is no different or better way to achieve the result I'm looking for, I have two ideas. I'd like to know which one would be more wise for me to choose. Please note that I really really want to find a coded and more elegant solution than these ideas I have, but I'm determined to achieve the eyeblink result.
Idea 1:
Would it be possible to create a "ghost" of the eyeblink parameter, which doesn't blink, and then a "real" version that blinks?
The ghost is the eyeblink value without any blinking. The on-screen blinking will take the Ghost value when it is not blinking, but when the blinking motion is activated, it will do the blink and ignore the Ghost value, until it returns to it.
Idea 2:
I could make an additional parameter called "Force Blinking", which looks like the chart above, and then control the blinking through it by having the value of "Force Blinking" change from 1.0 to 0.0 and then back at random moments, like normal blinking.
I repeat that I would much prefer to find a simpler and coded solution, but I am currently not knowledgeable enough in coding and Live2D's SDK to know how to do it in a better way, so please forgive my clumsiness.
I deeply appreciate the input until now, and thank you in advance for reading my long post.
Thanks for the detailed explanation. As naotaro pointed out
multParamFloat()
should be the way to go. But this might be an issue with the framework. Could you replace the the file in the framework with the one attached to this message and check whether it works better?In your own code use the initial version naotaro posted, i.e.:
// Breath double timeSec = UtSystem.getUserTimeMSec() / 1000.0; double t = timeSec * 2 * Math.PI; live2DModel.setParamFloat("PARAM_BREATH", (float)(0.5f + 0.5f * Math.Sin(t / 3.0))); // EYE Blink eyeBlink.setParam(live2DModel);
Please let me know if that worked.
I'm sorry, but your proposed code does not work. The cs file you have linked me is missing the "setParam" function which you're asking me to add.
However, "updateParam()" does exist, so I've tried with "eyeBlink.updateParam(live2DModel)" instead.
That didn't work either. Full experience and testing with this in the spoiler.
I tried adding a Debug.Log() to every switch case within the EyeBlink code and then I ran it, but without "Debug.Log("EyeStateInterval")" because it was too spammy (https://i.gyazo.com/7fa6857f21d74a318d19cacd59c9170b.png). I got the following:
I tried changing "MultParamfloat" to "SetParamFloat", and it worked!...But I got the 100% open eye problem again.
Does the "Mult" in MultParamfloat mean Multiply? Maybe the eyes remain closed because once the eyes are at 0, the eyeblink is then multiplying something by zero to open it again and getting more zero?
Since "SetParam" works, but had the 100% eye-open problem, what I did was to adjust to what value the SetParam reached upon performing the eye-opening action by setting it to be what value it has when motionMgr.isFinished() is called. My solution unfortunately doesn't work for mtns that are being played live due to that, but the result still looks natural and a couple of my motions actually implement blinking as part of the emotion being shown (especially in the Tsundere's case, example here: http://i.imgur.com/Oqw9gzO.gif, as she condescends people or blinks repeatedly while being flustered and blushing). So it's a feature that works in my favor, since automated blinking without that feature could've interfered with the expression.
Here it is if you'd like to check it out. It's a variation of the regular L2DEyeblink but its within the Model's cs file.
in Update()
Additional functions