ExtrudeShape does not seem to follow the path i give it

I’m using the extrudeShape method from the shape builder to extrude a facet on pick.

I’m path the path composed of the shape position and the (face position+ face normal)

I think it’s a bug within babylon.

I’ll let you check my implementation here: https://playground.babylonjs.com/#X3UQ4P#9

Adding @JohnK who may be able to help :slight_smile:

Hi @Tawfik and welcome to the forum from me.

Possibly to do with how you determine the shape to extrude. My method uses a ribbon rather than extrudeShape (which by the way uses createRibbon to build the extrusion)

Extrusions restricted to box https://playground.babylonjs.com/#X3UQ4P#10
Extrude from any mesh https://playground.babylonjs.com/#X3UQ4P#11

2 Likes

okey but we’re using createRubbon instead of extrudeShape.

should i open an issue on the github repo?

From my point of view your code is somewhat too complex for me to spend time checking especially as I doubt it is a Babylonjs error. You could do a couple of checks by drawing your shape to extrude with CreateLines and the same for your path.

You could use ExtrudeShape with my method however to set the shape to extrude you would need to rotate the facet so that it lies on the xy plane and then read its rotated vertex positions

2 Likes

Hey John,

So i debugged it with extrudeShape by adding a plane to get it to the xy plane and got to this:

https://playground.babylonjs.com/#X3UQ4P#20

it’s still a bit buggy, on some faces (the one below for example) i get inversed meshes.

any idea on how to fix it?

This problem is due to to the way the extrusion shape is computed and can be fixed by setting the first normal in the Path3D object used to compute normal for the extrusion. See this discussion: Need help getting piecewise extrusion to look like longer extrusion - #5 by lowclouds

It looks like this fix was incorporated into Babylon 5.9.0, but there is a bug in it that kills the fix -

// extruded shape creation
path3D = firstNormal ? new Path3D(curve, firstNormal) : new Path3D(curve);
path3D = <any>new Path3D(curve);

the second line overwrites the fix

1 Like