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

How to stop a motion and play another?

edited February 2016 in Help
i use sampleapp1 as the sample project.

when i play in unity with my own model, idle motion was the first motion that started.
i click the model then another motion playing successfully.
my problem is: it cant be stop and cant back to idle motion.
is there setting of motion i missed in live2d viewer or mybe in live2d animator? could you help me please?
thank you very much :)
Tagged:

Comments

  • Motion playback I have randomly StartRandomMotion() in LAppModel.cs.

    [Scripts/sample/LAppModel.cs]
    // IDLE Motion
    public void Update(){
      ・
      ・
    if (mainMotionManager.isFinished())
    {

    StartRandomMotion(LAppDefine.MOTION_GROUP_IDLE, LAppDefine.PRIORITY_IDLE);
    }
      ・
      ・
    }

    // Tap Event
    public bool TapEvent(float x, float y){
    if (LAppDefine.DEBUG_LOG) Debug.Log("tapEvent view x:" + x + " y:" + y);

    if (HitTest(LAppDefine.HIT_AREA_HEAD, x, y))
    {

    if (LAppDefine.DEBUG_LOG) Debug.Log("Tapped face");
    SetRandomExpression();
    }
    else if (HitTest(LAppDefine.HIT_AREA_BODY, x, y))
    {
    if (LAppDefine.DEBUG_LOG) Debug.Log("Tapped body");
    StartRandomMotion(LAppDefine.MOTION_GROUP_TAP_BODY, LAppDefine.PRIORITY_NORMAL);
    }
    return true;
    }
    If you specify the motion you want to play in the model.json, it will be played in random.
    [model.json]
    "motions":
    {
    "idle":
    [
    {"file":"motions/idle_00.mtn" ,"fade_in":2000, "fade_out":2000},
    {"file":"motions/idle_01.mtn" ,"fade_in":2000, "fade_out":2000},
    {"file":"motions/idle_02.mtn" ,"fade_in":2000, "fade_out":2000}
    ],
    "tap_body":
    [
    { "file":"motions/tapBody_00.mtn" , "sound":"sounds/tapBody_00.mp3","fade_out":0},
    { "file":"motions/tapBody_01.mtn" , "sound":"sounds/tapBody_01.mp3","fade_out":0},
    { "file":"motions/tapBody_02.mtn" , "sound":"sounds/tapBody_02.mp3","fade_out":0}
    ],
    }
    Because to be processed in the following order , try to debug in IdleMotion Start.

    1. IdleMotion Start → LAppModel.cs Update()
    2. TapEventMotion Start → LAppModel.cs TapEvent()
    3. IdleMotion Start → LAppModel.cs Update() ※ Only when the motion is finished.
  • so, do you mean i must add the lappmodel.cs Update() again after TapEvent() finished? o
    or add lappmodel.cs Update() into TapEvent()?

    sorry im new for C# user. its difficult to understand
  • LAppModel.cs of code I wrote earlier is the code that is included in the SDK samples.
    So, modification of the program is not required.

    Please check the mainMotionManager.isFinished() that is in the public void Update().
    Then, you can detect whether you are idle motion is being played.

    Then, StartRandomMotion is to run the idle motion.
    In other words, please confirm that this is running correctly.

    Another reason for the idle motion is not played, the setting of model.json might bad.
  • hi naotaro, i was checked the mainMotionManager.isFinished() and StartRandomMotion
    it was ran correctly
    now my model work! :)
    i found my setting of model.json was wrong.

    if i have any problem i`ll ask you again :)
    thank you very much for your help :D
Sign In or Register to comment.