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

4

1 回答 1

1

这是克隆功能中的一个错误。现在在最新的 2.2 版本中已修复此问题

于 2015-09-18T13:33:23.190 回答