Jump to content

Updating a Mesh


JohnK
 Share

Recommended Posts

Just started to use babylon.js and am enjoying its potential.
 
I have successfully created a curved by adjoining a sequence of points as in

curve = BABYLON.Mesh.CreateLines("curve", path, scene, true);

and adjusted points on the path and updated the curve using

curve = BABYLON.Mesh.CreateLines(null, path, null, null, curve);

However when I add new points to the path updating the curve using the above code does not give the correct new curve.

 

Using

curve = BABYLON.Mesh.CreateLines("curve", path, scene, true);

once again draws the correct new curve but leaves behind the original curve.

 

Is there a method of adding points to a path and to update the curve?

 

How do you delete an existing mesh in a scene?

 

Link to comment
Share on other sites

Hello and welcome!

 

You cannot add nor remove elements this way. You have to create a brand new curve (meaning without referencing the previous one with the latest parameter)

 

Under the hood, this is because we can easily update the underlying vertex buffer but we need to create a new one if we have to change its size

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