satguru Posted December 17, 2017 Share Posted December 17, 2017 In this playground I create a cube then get its vertices data https://www.babylonjs-playground.com/#LQDMJ6 When I get the vertices data using box.getVerticesData(BABYLON.VertexBuffer.PositionKind); I get an array containing 72 elements How come? A cube has 8 vertices Shouldn't the array have only 8*3 = 24 elements ? Same thing with NormalKind. I get an array with 72 elements! Quote Link to comment Share on other sites More sharing options...
jerome Posted December 17, 2017 Share Posted December 17, 2017 A cube has 24 vertices and not 8 (so 24 * 3 = 72 floats). Why 24 ? because vertices aren't shared between the box sides. This is necessary to hold the normals what are also not shared ... in order to get 3 normals per box vertices, each one being orthogonal to a different box side. satguru 1 Quote Link to comment Share on other sites More sharing options...
JohnK Posted December 17, 2017 Share Posted December 17, 2017 http://doc.babylonjs.com/resources/normals#normals-and-minimum-vertices GameMonetize and satguru 2 Quote Link to comment Share on other sites More sharing options...
satguru Posted December 17, 2017 Author Share Posted December 17, 2017 @jerome ahh.. makes sense, thx @JohnK we do have great documentation, don't we !! Working on a mesh/terrain editor. here some work in progress https://ssatguru.github.io/BabylonJS-MeshEditor/demo/index.html Wingnut 1 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.