Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Please limit one question/topic per post.
Please provide the following details depending on types of question

▼ For question regarding Editor, please provide:
- Live2D Software Version: (e.g. Cubism Editor 3.1.02, Euclid Editor 1.2.02)
- OS & Version: (e.g. Windows 10, macOS HighSierra)
- PC Model: (e.g. MacBookPro 2017)
- Graphics Specifications: (e.g. GeForce GTX 950M)
- Memory: (e.g. 8GB)
- Illustration Software used: (e.g. Photoshop, ClipStudio, SAI)
- Attach screenshot or capture video to show your problem:
---------------------------
▼ For question regarding SDK, please provide:
- For us to reproduce the issue you wish to inquire about, please provide either a minimum project file which has the issue. or specific instructions on how to reproduce the issue.
- Types and version of Cubism SDK you are using.
---------------------------
▼ For question regarding Cubism Software License,
For issues related to purchasing, your order, license key, and subscription, please contact us via contact form:
https://www.live2d.com/en/contact/contact_form

Manipulating L2DEyeBlink.cs

edited July 2016 in Help
Hello,
Using the Simple.cs script, I was trying to create a L2DViewer like parameter list for integrating into Fungus.

The problem is that because the L2DEyeBlink script also uses the parameters of "PARAM_EYE_L_OPEN" and "PARAM_EYE_R_OPEN", only the latest function would only activate, limiting me to either have a nomal blinking or a steady stare.

e.g: this code would only display a blinking character without eye open control, putting the eyeBlink.setParam on top in turn would display a staring character but with eye open control.



I then went into the L2DEyeBlink script and noticed the function for the blink is :

public void updateParam(ALive2DModel model)
{


long time = UtSystem.getUserTimeMSec();
float eyeParamValue;
float t = 0;

switch (this.eyeState)
{
case EYE_STATE.STATE_CLOSING:

t = (time - stateStartTime) / (float)closingMotionMsec;
if (t >= 1)
{
t = 1;
this.eyeState = EYE_STATE.STATE_CLOSED;
this.stateStartTime = time;
}
eyeParamValue = 1 - t;
break;
case EYE_STATE.STATE_CLOSED:
t = (time - stateStartTime) / (float)closedMotionMsec;
if (t >= 1)
{
this.eyeState = EYE_STATE.STATE_OPENING;
this.stateStartTime = time;
}
eyeParamValue = 0;
break;
case EYE_STATE.STATE_OPENING:
t = (time - stateStartTime) / (float)openingMotionMsec;
if (t >= 1)
{
t = 1;
this.eyeState = EYE_STATE.STATE_INTERVAL;
this.nextBlinkTime = calcNextBlink();
}
eyeParamValue = t;
break;
case EYE_STATE.STATE_INTERVAL:
//
if (this.nextBlinkTime < time)
{
this.eyeState = EYE_STATE.STATE_CLOSING;
this.stateStartTime = time;
}
eyeParamValue = 1;
break;
case EYE_STATE.STATE_FIRST:
default:
this.eyeState = EYE_STATE.STATE_INTERVAL;
this.nextBlinkTime = calcNextBlink();
eyeParamValue = 1;
break;
}
The solution here was to change the 1's into the variable that holds the eyeopen value in my original script ( (float) (ea) ) in order to become the upper bound for blinking.
The problem is, the system does not allow me to execute a getComponent within this function so I could not send over the value.
Is there any way I could pass it into the function?

Comments

  • Hey, thanks for your interest in Live2D! I think one easy way to do what you want to achieve is by patching the parameters each frame after eye blinking has run, i.e. after eye blinking has been updated you do something like:
    if (live2DModel.getParamFloat("PARAM_EYE_L_OPEN") > ea)
    {
      live2DModel.setParamFloat("PARAM_EYE_L_OPEN", ea);
    }
    Would that be an option?
  • Thank you for replying, but it seems that I have managed to have the newer LappProxy to work with fungus and just make the expressions in the actual L2D Viewer. So I'll be closing this.
Sign In or Register to comment.