I’m trying to create ExtrudeGeometry with Shape and CatmullRomCurve3,but aspect of ExtrudeGeometry will be rotate 90deg if the CatmullRomCurve3 is not a straight path on x-axis.
So how can i make the aspect not be rotated with different kinds of paths?
- a straight path on x-axis
const shape = new THREE.Shape();
shape.moveTo(-5, 5);
shape.lineTo(5, 5);
shape.lineTo(10, -5);
shape.lineTo(-10, -5);
shape.lineTo(-5, 5);
const points = [
new THREE.Vector3(0, 0, 0),
new THREE.Vector3(100, 0, 0),
];
const path = new THREE.CatmullRomCurve3(points);
const geo = new THREE.ExtrudeGeometry(shape, {
extrudePath: path,
steps: 1000,
bevelEnabled: false,
});
const mat = new THREE.MeshPhongMaterial({ color: 0x00ffff });
const mesh = new THREE.Mesh(geo, mat);
scene.add(mesh);
- a straight path on y-axis
just changed points to
const points = [
new THREE.Vector3(0, 0, 0),
new THREE.Vector3(0, 0, 100),
];
- curved path
const points = [
new THREE.Vector3(0, 0, 0),
new THREE.Vector3(20, 0, 10),
new THREE.Vector3(40, 0, 15),
new THREE.Vector3(60, 0, 25),
new THREE.Vector3(80, 0, 40),
new THREE.Vector3(100, 0, 60),
];