Jump to content

ExtrudeShapeCustom not working right


Recommended Posts

Hi, I am trying to extrude a polygon using ExtrudeShapeCustom.

I need to use this because I need to access the scale function.

It seems that a polygon with concave shapes messes it up.

code: var c = BABYLON.Mesh.ExtrudeShapeCustom("name", polygon, path, Scale, Rotation, false, true, 3, scene);

When creating the same with below polygonMeshBuilder it works.

var c = new BABYLON.PolygonMeshBuilder("name", polygon, scene).build(1,depth);

My issue is that I need to scale down so the polygon gets smaller as it extrudes.

Is there a fix for this?

I have attached screenshots of the polygonMeshBuilder (which looks ok but without any scaling) and the ExtrudeCustomShape (which is messed up) 

Screen Shot 2017-11-07 at 4.52.03 PM.png

Screen Shot 2017-11-07 at 4.50.36 PM.png

Link to comment
Share on other sites

yes, the capping process is quite simple and based on the computation of the barycenter only (not a real triangulation algo) ... something that could be improved actually.

For now, if you need a better cap, you could build a polygon from the shape that you extrude (with http://doc.babylonjs.com/how_to/polygonmeshbuilder) or that you use JohnK's polygonExtruder 

Link to comment
Share on other sites

  • 4 weeks later...

Hi Jerome and JohnK,

Is there anyway I can request the improvement of the capping algorithm for extrudecustomshape? or pay someone to do it?

I really need to be able to run the scaling function to taper down the sides.

I appreciate your help and feedback.



Link to comment
Share on other sites

Bit trickier than I thought but here it is https://www.babylonjs-playground.com/#KCFUE2#3

 but I may have got it upside down so https://www.babylonjs-playground.com/#KCFUE2#4

Note that because your poly data is all positive and scaling is set at the origin the shape is skewed see better with bigger chamfer  https://www.babylonjs-playground.com/#KCFUE2#5

If you want to the base centres in alignment then you need to adjust your data to have the origin at the centre https://www.babylonjs-playground.com/#KCFUE2#6

Link to comment
Share on other sites

  • 2 weeks later...

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...