leota

How to dynamically update the geometry of a mesh?

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 :)

Share this post


Link to post
Share on other sites

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

 

Share this post


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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.