adam Posted June 4, 2016 Share Posted June 4, 2016 I'd like to be able to update the geometry of one of my meshes after it is created. There doesn't seem to be any setters for updatable in the buffer class, though. https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.buffer.ts#L6 Quote Link to comment Share on other sites More sharing options...
jerome Posted June 4, 2016 Share Posted June 4, 2016 maybe you should work at the VertexData level : https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.mesh.vertexData.ts If the mesh is created with the BJS CreateXXX() methods, you can directly use this : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#other-shapes-updatemeshpositions adam 1 Quote Link to comment Share on other sites More sharing options...
adam Posted June 4, 2016 Author Share Posted June 4, 2016 My mesh is from a model I created in Blender. I used to be able to do this: var vb = mesh.getVertexBuffer(BABYLON.VertexBuffer.PositionKind); vb._updatable = true; var vertices = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind); and then update the vertices array directly. It doesn't seem to work anymore. Quote Link to comment Share on other sites More sharing options...
adam Posted June 4, 2016 Author Share Posted June 4, 2016 I'm now using the export file from Tower of Babel. The vertex buffer isUpdatable() is returning true, but the geometry doesn't update when I update the positions array. Vertices are moving now that I'm using the updateMeshPositions function. I noticed that the length of the vertex positions array is almost 3 times the length of the positions array that was used when creating the vertex positions. (1974 vs 5616) So even if it updated, I'd probably be referencing the wrong positions. (the difference in array length was because I converted my mesh to flat shaded) Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 5, 2016 Share Posted June 5, 2016 Do your flat shading in Blender. Your JS file will be bigger, but will correct your problem. In QI.Mesh proper there is: /** @override */ public convertToFlatShadedMesh() : void { if (this._shapeKeyGroups.length > 0){ BABYLON.Tools.Error("QI.Mesh: Flat shading must be done on export with shape keys"); return null; }else super.convertToFlatShadedMesh(); } 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.