I want to create a fish model dynamically. What I tried was to create a bunch of cylinders and change the top and bottom radius so that I get the shape of a fish:
let end= 0.1;
let start = 0.1;
let colors = [0xff0000,0xffff00,0x00ff00,0x00f0ff,0x0000ff,0x00ffff,0xf000ff, 0x1200ff,0x0200f0,0x00ff01,0x0fff0f,0xffff00,0x00ff00,0x00f0ff,0x0000ff,0x00ffff,0xf000ff, 0x1200ff,0xffff00,0x00ff00,0x00f0ff,0x0000ff,0x00ffff,0xf000ff, 0x1200ff];
let fishG = new THREE.Group();
for(let i=1; i<15; i++){
start = end;
console.log("sin",start);
end = Math.sin(i/4);
console.log(i)
geometry = new THREE.CylinderGeometry( start, end, 0.2, 32 );
material = new THREE.MeshBasicMaterial( {color: colors[i]} );
mesh = new THREE.Mesh( geometry, material );
mesh.position.y = 0.2*-i;
mesh.name = "cyc"+start+"_"+end;
fishG.add(mesh);
}
It looks nice, but it is not really the type of fish I want.
The belly of the fish should be flat, what makes the form of the fish not symmetrical anymore, something like this:
my dream goal
But since I know sweep nurbs does not exist in Three.js I don’t know what is the best approach to achieve my goal - I want to have full control over the shape of the fish. What I can imagine is maybe creating one fillet (one of those cones with flat bottom) in another program and arrange them like I did + add skinnedMesh on top of it to adjust the ‘thickness’ during the axis.
I saw Klaus Hoffmeisters work sandbox and think it is possible to create something like that just by code, but I have yet no idea where to start (to learn).