KarelAnker Posted December 18, 2015 Share Posted December 18, 2015 http://imgur.com/PDBj6MG Basically I'm trying to extrude a shape on the Y axis. All of the points have a Y of 0, only the X and Z are differing each time.When you're looking at the picture, you can see the white lines are the points connected by BABYLON.MeshBuilder.CreateLines, so the points shouldn't be the problem. However, if you are looking at that big grey thing going in the air, that's the extruded shape from the points. It seems that it doesn't extrude properly on the Y axis so it's really messed up. The code looks like this:BABYLON.MeshBuilder.CreateLines("line", { points: meshPoints }, scene);var block = BABYLON.MeshBuilder.ExtrudeShape("block", {shape: meshPoints,path: [new BABYLON.Vector3(0, -1, 0), new BABYLON.Vector3(0, 0, 0)],scale: 1,cap: BABYLON.Mesh.CAP_ALL}, scene);As you can see, I just want it to be extruded from the bottom to the top, which should result in a box which follows the mesh points. It should look like the white lines, but then filled up and having a "height" to it. Quote Link to comment Share on other sites More sharing options...
jerome Posted December 18, 2015 Share Posted December 18, 2015 The logical model to be extruded must be defined in the xOy plane : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusionSo all its z values equal to zero.This is a requirement. Quote Link to comment Share on other sites More sharing options...
KarelAnker Posted December 18, 2015 Author Share Posted December 18, 2015 The logical model to be extruded must be defined in the xOy plane : http://doc.babylonjs.com/tutorials/Parametric_Shapes#extrusionSo all its z values equal to zero.This is a requirement.Ah.. Do you have any alternative suggestions to achieve my idea? Quote Link to comment Share on other sites More sharing options...
jerome Posted December 18, 2015 Share Posted December 18, 2015 Just convert your array points (or clone it to another) so you redfine the shape in the xOy plane.The model shape is not a mesh, it's just a logical model : a series of vector3 Quote Link to comment Share on other sites More sharing options...
KarelAnker Posted December 18, 2015 Author Share Posted December 18, 2015 Just convert your array points (or clone it to another) so you redfine the shape in the xOy plane.The model shape is not a mesh, it's just a logical model : a series of vector3I've partially fixed it, however there's one problem which I can't figure out: http://www.babylonjs-playground.com/#RF9W9#181 As you can see, when you add the "cap" option, there are some weird black parts and parts which shouldn't be capped at all. (PS: I added some alpha so you can see the yellow line representing the shape..) Quote Link to comment Share on other sites More sharing options...
jerome Posted December 18, 2015 Share Posted December 18, 2015 I'm afraid that with non-concave model shapes the results of the capping process (based on barycenter computation) may differ from what you may expect. Quote Link to comment Share on other sites More sharing options...
jerome Posted December 20, 2015 Share Posted December 20, 2015 The computation of the barycenter for extruded shape caps is a design choice (cf previous posts in another topic) to keep a good performance when morphing dynamically the extruded shape : http://www.babylonjs-playground.com/#20IBWW#2It works quite well for concave model shape but can have weird results for conves ones.Maybe, in your case, you might use the polygon builder instead of the extrusion embedded capping. 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.