# ExtrudeShape does not seem to follow the path i give it

**URL:** <https://forum.babylonjs.com/t/extrudeshape-does-not-seem-to-follow-the-path-i-give-it/19579>\
**Category:** Bugs\
**Created:** [March 30, 2021, 6:24pm UTC](https://forum.babylonjs.com/t/extrudeshape-does-not-seem-to-follow-the-path-i-give-it/19579 "2021-03-30T18:24:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tawfik](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tawfik/32/15213_2.png) [@Tawfik](https://forum.babylonjs.com/u/Tawfik)\
**Post date:** [March 30, 2021, 6:24pm UTC](https://forum.babylonjs.com/t/extrudeshape-does-not-seem-to-follow-the-path-i-give-it/19579/1 "2021-03-30T18:24:35Z")

</div>

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](https://playground.babylonjs.com/#X3UQ4P#9)

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 30, 2021, 9:17pm UTC](https://forum.babylonjs.com/t/extrudeshape-does-not-seem-to-follow-the-path-i-give-it/19579/2 "2021-03-30T21:17:42Z")

</div>

Adding @JohnK who may be able to help 🙂

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [March 31, 2021, 11:59am UTC](https://forum.babylonjs.com/t/extrudeshape-does-not-seem-to-follow-the-path-i-give-it/19579/3 "2021-03-31T11:59:18Z")

</div>

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](https://playground.babylonjs.com/#X3UQ4P#10)  
Extrude from any mesh [https://playground.babylonjs.com/#X3UQ4P#11](https://playground.babylonjs.com/#X3UQ4P#11)

---

<div class="post-metadata">

**Author:** ![Tawfik](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tawfik/32/15213_2.png) [@Tawfik](https://forum.babylonjs.com/u/Tawfik)\
**Post date:** [March 31, 2021, 9:20pm UTC](https://forum.babylonjs.com/t/extrudeshape-does-not-seem-to-follow-the-path-i-give-it/19579/4 "2021-03-31T21:20:13Z")

</div>

okey but we’re using createRubbon instead of extrudeShape.

should i open an issue on the github repo?

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [April 1, 2021, 12:32am UTC](https://forum.babylonjs.com/t/extrudeshape-does-not-seem-to-follow-the-path-i-give-it/19579/5 "2021-04-01T00:32:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tawfik](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tawfik/32/15213_2.png) [@Tawfik](https://forum.babylonjs.com/u/Tawfik)\
**Post date:** [April 13, 2021, 7:42pm UTC](https://forum.babylonjs.com/t/extrudeshape-does-not-seem-to-follow-the-path-i-give-it/19579/6 "2021-04-13T19:42:41Z")

</div>

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](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?

---

<div class="post-metadata">

**Author:** ![lowclouds](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/lowclouds/32/26590_2.png) [@lowclouds](https://forum.babylonjs.com/u/lowclouds)\
**Post date:** [June 10, 2022, 6:31pm UTC](https://forum.babylonjs.com/t/extrudeshape-does-not-seem-to-follow-the-path-i-give-it/19579/7 "2022-06-10T18:31:33Z")

</div>

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](https://forum.babylonjs.com/t/need-help-getting-piecewise-extrusion-to-look-like-longer-extrusion/29903/5)

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
