gaelbeltran Posted September 30, 2015 Share Posted September 30, 2015 Hello, I was wondering if there's a way to make a cylinder and remove his top and bottom faces. And also if is possible to customize his number of faces, like an octagon, hexagon, etc.I'd prefer not to load a new model for a simple mesh like that. Quote Link to comment Share on other sites More sharing options...
adam Posted September 30, 2015 Share Posted September 30, 2015 You can use createTube: http://www.babylonjs-playground.com/#1A4DON#13 or createLathe: http://www.babylonjs-playground.com/#1KN1LB#25 gaelbeltran 1 Quote Link to comment Share on other sites More sharing options...
gaelbeltran Posted September 30, 2015 Author Share Posted September 30, 2015 Wow, that's EXACTLY what I was looking for! Thanks. Quote Link to comment Share on other sites More sharing options...
mwpowellhtx Posted March 25, 2016 Share Posted March 25, 2016 What about if you want to control the thickness? Say with OD 12" and ID 10"; or what have you. Quote Link to comment Share on other sites More sharing options...
adam Posted March 25, 2016 Share Posted March 25, 2016 I'd use CSG like this: http://www.babylonjs-playground.com/#1F1AHQ#2 Quote Link to comment Share on other sites More sharing options...
HiteshSahu Posted February 16, 2020 Share Posted February 16, 2020 More Generic approach to create hollow Cylinder and Coneshttps://www.babylonjs-playground.com/#1F1AHQ#10 for hollow tube set var outerTopDiameter = 4 var outerBottomDiameter = outerTopDiameter var height = 5; var thickness = .1 //Outer Cylinder var outerTopDiameter = 4 var outerBottomDiameter = 7 //Inner Cylinder var innerTopDiameter = outerTopDiameter - thickness var innerBottomDiameter = outerBottomDiameter - thickness var tess = 20; var inner = BABYLON.MeshBuilder.CreateCylinder("cone", { diameterTop: innerTopDiameter, diameterBottom: innerBottomDiameter, height: height, tessellation: tess }, scene); //BABYLON.Mesh.CreateCylinder("inner", height, innerDiameter, innerDiameter, tess, 1, scene); var outer = BABYLON.MeshBuilder.CreateCylinder("cone", { diameterTop: outerTopDiameter, diameterBottom: outerBottomDiameter, height: height, tessellation: tess }, scene); //BABYLON.Mesh.CreateCylinder("outer", height, outerDiameter, outerDiameter, tess, 1, scene); var innerCSG = BABYLON.CSG.FromMesh(inner); var outerCSG = BABYLON.CSG.FromMesh(outer); var subCSG = outerCSG.subtract(innerCSG); var mat0 = new BABYLON.StandardMaterial("mat0", scene); var newMesh = subCSG.toMesh("csg2", mat0, scene); scene.removeMesh(inner); scene.removeMesh(outer); 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.