Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

If you have any questions, reports, suggestions, or requests about Live2D, please send them to this forum.
※We cannot guarantee statements or answers from Live2D staff. Thank you for your understanding in advance.
 
Live2D Cubism
Cubism Products and Downloads
Cubism product manuals and tutorials
Cubism Editor Manual    Cubism Editor Tutorial    Cubism SDK Manual    Cubism SDK Tutorial
[Notice of Holidays]
Please note that our staff will not be available from 2024/Dec/28 - 2025/Jan/5 JST.
The Live2D Creators Forum will remain open during the holidays.
Submissions that require a response will be answered after we reopen for business.
Please note that it will take longer than usual to respond to your request.

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.