Dear Users,

Now, we are seeking users who can give us a hand with expertise to evolve our software more dynamically.
If you are willing to help us, we’d like you to make a registration for “Live2D Creators Circle” via the link below.
Designers, programmers, translators are especially welcomed so far.
(More detailed explanation will be given to you before we ask you to do tasks)

https://docs.google.com/forms/d/1G5KK_GL3ozwPXtTHrpi_ktbsI8UZf8jlYRSlDworyBo/viewform?usp=send_form

Question - Display part of the Live2D Model | Cubism | JS

Is there a way to display only part of a live2d model? (eg: displaying only the head)

Thanks in advance)

Comments

  • edited February 2016
    Hi, Rus .
    I have to display some of the parts in the following code .
    
    // Define Live2D model
    var MODEL_PATH = "assets/haru/";
    var MODEL_DEFINE = {
        "type":"Live2D Model Setting",
        "name":"haru",
        "model": MODEL_PATH + "haru.moc",
        "textures":[
            MODEL_PATH + "haru.1024/texture_00.png",
            MODEL_PATH + "haru.1024/texture_01.png",
            MODEL_PATH + "haru.1024/texture_02.png",
        ],
        "motions":[
            MODEL_PATH + "motions/idle_00.mtn",
            MODEL_PATH + "motions/tapBody_06.mtn",
            MODEL_PATH + "motions/tapBody_09.mtn",
        ],
        "parts":[
            "PARTS_01_FACE_001", "PARTS_01_HOHO_001", "PARTS_01_EYE_001",
            "PARTS_01_EYE_BALL_001", "PARTS_01_BROW_001", "PARTS_01_MOUTH_001",
            "PARTS_01_NOSE_001", "PARTS_01_EAR_001", "PARTS_01_HAIR_FRONT_001",
            "PARTS_01_HAIR_BACK_001", "PARTS_01_HAIR_SIDE_001", "PARTS_01_NECK_001",
            "PARTS_01_BODY_001", "PARTS_01_ARM_L_A_001", "PARTS_01_ARM_R_A_001",
        ],
    };
    .
    .
    .
    // Hide all the parts
    for(var j = 0; j < MODEL_DEFINE.parts.length; j++){
        live2DModel.setPartsOpacity(MODEL_DEFINE.parts[j], 0.0);
    }
    
    // Display only back hair
    that.live2DModel.setPartsOpacity("PARTS_01_HAIR_BACK_001", 1.0);
    
    // Live2D Draw
    that.live2DModel.draw();
    
  • I had it here and it worked. Thank you.
    
    draw = function(gl){	
        ...
        live2DModel.setPartsOpacity("PARTS_ ... ", 0);	
        motionMgr.updateParam(live2DModel);
        live2DModel.update(); 
        live2DModel.draw();	
    }
    
  • A related question.

    If I have a live2d model, consisting of a head and a body. But I only want to load and display the head, and ignoring the body completely (ie: not load and hence not display the body). How do I do that?

    Thanks in advance)
Sign In or Register to comment.