0

I am new to BabylonJS and WebGL. I started with reading the basic tutorials such as this and this, and also visiting the suggested demos in playground.

I have one question regarding cloning line meshses. I tried to clone a cube mesh and rotating it, and it is working (Playgorund link).

However the same stategy is not working with lines mesh and I wanted to know what is the right way of doing it. I have also created a demo for what I have done so far in Playground. The cloned line mesh is not visible initially and can only be made visible partially when rendering mode "Wireframe" is selected, as can be seen below.

It will be great, if you please help me understading this better.

createScene():

var createScene = function () {
    //Here goes the scene, light, and camera (skipped for brevity)

    // Creation of a triangular lines mesh
    var myLines = BABYLON.Mesh.CreateLines("myLines", [
            new BABYLON.Vector3(-5, 0, 5),
            new BABYLON.Vector3(5, 0, 5),
            new BABYLON.Vector3(0, 0, -5),
            new BABYLON.Vector3(-5, 0, 5)
    ], scene);

    myLines.color = new BABYLON.Color3(0, 1, 0);
    myLines.position = new BABYLON.Vector3(3, 0, 0);

    //Clone
    var newLines = myLines.clone("newLines");
    newLines.position = new BABYLON.Vector3(-3, 0, 0);
    newLines.color = new BABYLON.Color3(1, 1, 0);

    // newLines.rotate(BABYLON.Axis.Y, Math.PI / 2, BABYLON.Space.WORLD);

    return scene;
}

Demo Screenshot

gman
  • 100,619
  • 31
  • 269
  • 393
Sayan Pal
  • 4,768
  • 5
  • 43
  • 82

1 Answers1

1

it was a bug in the clone function. This is now fixed in latest 2.2 version

David Catuhe
  • 1,747
  • 1
  • 10
  • 9