Jump to content

How to dynamically update the geometry of a mesh?


leota
 Share

Recommended Posts

I've created a BoxGeometry and assigned it to a Mesh, then when I click on the Mesh I would like to trigger an update of the geometry, for example change its "size" parameter. Is there a method I need to call on the Mesh to update it? I can see that the size property of the geometry gets updated, but the Mesh is still using the cached version.

This is probably an easy thing to do, but I'm struggling a bit as I'm very new to Babylon.

I've created a PG here: http://www.babylonjs-playground.com/#JTA9RH

Any help would be much appreciated :)

Link to comment
Share on other sites

4 minutes ago, Deltakosh said:

Hello everything is here:

http://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh

Here is an example: https://www.babylonjs-playground.com/#1UZIZC#6

 

If you want to use pure shape functions, I recommend to directly use the MeshBuilder: http://www.babylonjs-playground.com/#JTA9RH#2

 

Ok so basically I need to reassign the "mesh" variable to a newly created mesh. Thought there was a method to explicitly trigger a mesh update, but that's fine too. Thx!

Link to comment
Share on other sites

There is (the one I used in the playground I mentioned) but it forces you to build the geometry manually. If you just want to recreate a new geometry, then this is the best way :)

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