Jump to content

L shaped mesh creation using ribbon


masterdon
 Share

Recommended Posts

Hello everyone.

I am trying to create and L shaped and inverse L shaped room structure using paths that connects 6 points. The path array is passed to ribbon function. however i am not getting the desired result. Here is the code for same:

 

function drawRoomType2() {
    var mat = new BABYLON.StandardMaterial("mat1", scene);
    mat.alpha = 1.0;
    mat.diffuseColor = new BABYLON.Color3(0.5, 0.5, 1.0);
    mat.backFaceCulling = false;

    var sideO = BABYLON.Mesh.DEFAULTSIDE;;
    var pathArray = [];

    var subPath1 = [];
    for (var i = 10; i < 100; i++) {
        subPath1.push(new BABYLON.Vector3(i, 2, 11));
     
    }
    pathArray.push(subPath1);

    var subPath2 = [];
    for (var i = 11; i < 99; i++) {
        subPath2.push(new BABYLON.Vector3(100, 2, i));

    }
    //subPath2.push(new BABYLON.Vector3(100, 2, 11));
    //subPath2.push(new BABYLON.Vector3(100, 2, 99));
    pathArray.push(subPath2);

    var subPath3 = [];
    for (var i = 100; i < 50; i--) {
        subPath3.push(new BABYLON.Vector3(i, 2, 99));

    }
    //subPath3.push(new BABYLON.Vector3(100, 2, 99));
    //subPath3.push(new BABYLON.Vector3(50, 2, 99));
    pathArray.push(subPath3);


    var subPath4 = [];
    for (var i = 99; i < 49; i--) {
        subPath4.push(new BABYLON.Vector3(50, 2, i));

    }
    //subPath4.push(new BABYLON.Vector3(50, 2, 99));
    //subPath4.push(new BABYLON.Vector3(50, 2, 49));
    pathArray.push(subPath4);

    var subPath5 = [];
    for (var i = 50; i < 10; i--) {
        subPath4.push(new BABYLON.Vector3(i, 2, 49));

    }
    //subPath5.push(new BABYLON.Vector3(50, 2, 49));
    //subPath5.push(new BABYLON.Vector3(10, 2, 49));
    pathArray.push(subPath5);

    var subPath6 = [];
    subPath6.push(new BABYLON.Vector3(10, 2, 49));
    subPath6.push(new BABYLON.Vector3(100, 2, 11));
    pathArray.push(subPath6);
    var mesh = BABYLON.Mesh.CreateRibbon("ribbon", pathArray, false, false, 0, scene, true, sideO);
    mesh.material = mat;
}

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...