Gugis Posted June 4, 2016 Share Posted June 4, 2016 I've created ground mesh and I try to manimulate it's vertices positions with mouse click, however it does not work. Positions are changed but mesh is not being re rendered. Same goes for custom meshes (imported from Blender). Here's my playground, what do I miss? Quote Link to comment Share on other sites More sharing options...
adam Posted June 4, 2016 Share Posted June 4, 2016 You have to make the mesh updatable. http://www.babylonjs-playground.com/#1QM8F6#4 You helped me out with the issue I was having. I didn't know about the updateMeshPositions function. thanks Gugis 1 Quote Link to comment Share on other sites More sharing options...
Gugis Posted June 4, 2016 Author Share Posted June 4, 2016 1 hour ago, adam said: You have to make the mesh updatable. http://www.babylonjs-playground.com/#1QM8F6#4 You helped me out with the issue I was having. I didn't know about the updateMeshPositions function. thanks Thank you, sir P.S. how to make imported mesh updatable? Quote Link to comment Share on other sites More sharing options...
adam Posted June 5, 2016 Share Posted June 5, 2016 14 hours ago, Gugis said: how to make imported mesh updatable? The only way I was able to do that was by using the Tower of Babel exporter for Blender. https://github.com/BabylonJS/Extensions/tree/master/QueuedInterpolation/Blender Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 5, 2016 Share Posted June 5, 2016 To do it from a .babylon created mesh, convert to an updateable buffer via: mesh.setVerticesData(BABYLON.VertexBuffer.PositionKind, new Float32Array(mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind)), true); The Float32Array part is optional, but creates less garbage during morphing. After that: var data = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind); // do stuff to data mesh.updateVerticesData(BABYLON.VertexBuffer.PositionKind, data); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.