Gameatro

LineMesh not changing on update

Recommended Posts

I have just started learning Babylon.js and am trying to create a line that moves with moving of a html slider. I am using CreateLines function of Babylon for create a line. I have set update boolean to true. But even after updating the vertices, the new line is not rendered. When I print the vertices after changing, their value is changed, but the line displayed remains same. Here is my code for creating the line:

Xaxis =  BABYLON.MeshBuilder.CreateLines("Xaxis",{points:[new BABYLON.Vector3(1000,0,0),new BABYLON.Vector3(-1000,0,0)], updateable:true},scene);

And here is my code to update the line:

Xaxis =  BABYLON.MeshBuilder.CreateLines("Xaxis",{points:[new BABYLON.Vector3(1000,(vy/100)*newVal,(vz/100)*newVal),new BABYLON.Vector3(-1000,(vy/100)*newVal,(vz/100)*newVal)], updateable:true,instance:Xaxis});

here newVal is a variable which has the current value of the slider. What mistake am I doing?

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.