Amit Tomar
Amit Tomar

Reputation: 4858

ExtrudeBufferGeometry causing rotation of output

I am trying to extrude some shapes, however I am finding that after extruding, the output is looking like it has been rotated a bit.

I render the actual shape of the triangle and the extruded shape of the triangle after extruding in negative Z direction. Extruding works fine but there is a change in orientation of the output and it looks rotated.

This also happens when I use a custom curve to extrude along.

enter image description here

Here is the code :

https://codesandbox.io/s/extrude-oxf8v

Upvotes: 1

Views: 282

Answers (1)

Anoman.M
Anoman.M

Reputation: 122

I found a trick to handle this,and I have tested some cases it works just fine:

To extrude a any shape from A to B (vector3),while preventing it auto rotating:

  1. extrude geomtry using "depth" instead of "extrudePath"
  2. var mesh = new THREE.Mesh(geometry,material);
  3. mesh.position.copy(A) //positioning it to the start point
  4. mesh.lookAt(B) //things done!

Upvotes: 2

Related Questions