leota Posted July 20, 2018 Share Posted July 20, 2018 I have created a BoxGeometry and then added it to a Mesh. The problem is that no matter what size a give it, it always gets rendered as size=1. I also created a box using BABYLON.MeshBuilder.CreateBox(), and there it works fine, size is updated as expected. Here's the PG: http://playground.babylonjs.com/#UUJWXS Problem is at line 14: var box = new BABYLON.BoxGeometry('box', scene, 8, true, mesh, 4); as you can see size is set to 8, but actually it gets rendered smaller the the other box which has size 4. Quote Link to comment Share on other sites More sharing options...
jerome Posted July 20, 2018 Share Posted July 20, 2018 Where have seen that a box could be created just from a geometry object ? In BJS, a geometry is a logical (maths) object. A geometry is created when a mesh is created usually. Not the inverse. You can create a geometry for logical purposes and attach it to any mesh, but this won't change the mesh shape. Quote Link to comment Share on other sites More sharing options...
leota Posted July 20, 2018 Author Share Posted July 20, 2018 29 minutes ago, jerome said: Where have seen that a box could be created just from a geometry object ? In BJS, a geometry is a logical (maths) object. A geometry is created when a mesh is created usually. Not the inverse. You can create a geometry for logical purposes and attach it to any mesh, but this won't change the mesh shape. I come from Three.js, where you create a geometry and the assign it to a Mesh, and that's what the mesh will look like. So from what you're saying this is not possible in BJS, and I'm a bit confused about some concepts. What's the purpose of having a BoxGeometry class then? Can you please make a pratical example where I can use geometries? Quote Link to comment Share on other sites More sharing options...
Guest Posted July 20, 2018 Share Posted July 20, 2018 The goal is not to have two concepts for one thing: the geometry is an internal storage that can be used by several meshes but you should not have to worry about. You want a sphere? BABYLON.Mesh.CreateSphere is the way to go. For more control you can also use BABYLON.MeshBuilder.CreateSphere They will both return meshes. Internally there is a geometry that can be shared between meshes if you create clone. leota 1 Quote Link to comment Share on other sites More sharing options...
leota Posted July 20, 2018 Author Share Posted July 20, 2018 27 minutes ago, Deltakosh said: The goal is not to have two concepts for one thing: the geometry is an internal storage that can be used by several meshes but you should not have to worry about. You want a sphere? BABYLON.Mesh.CreateSphere is the way to go. For more control you can also use BABYLON.MeshBuilder.CreateSphere They will both return meshes. Internally there is a geometry that can be shared between meshes if you create clone. Ok thanks, it makes sense now. Quote Link to comment Share on other sites More sharing options...
Guest Posted July 20, 2018 Share Posted July 20, 2018 And welcome by the way 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.