Three.js geometry help

I would like to build such geometry in three.js

How can I do it.
Please help me :pleading_face:

Here is an idea:

Start with a cylinder with three layers of vertices. Keep the upper two layers unchanged. Modify only the bottom layer of vertices – reposition them into the vertices of a square. That’s all. Here is how it looks like in wireframe and in solid mode:

I will leave the actual coding to you.

3 Likes

Thank you, great idea.

Could you please explain how I can change the position of vertices of the cylinder geometry?

If you have any sample code, please share me.

Thank you again, Pavel

@PavelBoytchev Very cool approach. Actually, this was my first thought too, to deform a cylinder.
But I went the way of merging of geometries (custom one and an open-ended cylinder)

@cory
To change vertices of a geometry, you can use .setXYZ() method of BufferAttribute.

2 Likes