Jump to content

How to clone line meshes the right way?


sayan751
 Share

Recommended Posts

Hi,
 
I am really new to BabylonJS. I started with reading the basic tutorials shuch as this and this, and also visitng 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 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.

 

This is my createScene() method so far:

var createScene = function () {    //Here goes the scene, light, and camera (sipped 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;}

post-16459-0-42788900-1442485283_thumb.j

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...