我是 Three.js 的新手,我想垂直挤出一个形状。我可以设置 2D 形状的点,但是当我拉伸它时,拉伸会沿着 z 轴发生。我想沿着 y 轴挤出形状,如何以最简单的方式实现这一点?(在这个例子中,我知道可以使用盒子几何体,因为我挤出一个矩形,但这只是因为简单,我想挤出复杂的形状)。
我尝试过的一件事是在挤压网格后旋转网格,但这弄乱了我的起点(使得计算挤压对象所包含的对象的位置变得更加困难)。
所以为了简单起见,我想要这样的东西,没有旋转。
我的代码:
export function createStorageLocation(storageLocation: StorageLocation) {
const shape = new Shape();
shape.moveTo(0, 0);
shape.lineTo(0, 200 / 100);
shape.lineTo(400 / 100, 200 / 100);
shape.lineTo(400 / 100, 0);
shape.lineTo(0, 0);
const extrudeSettings: ExtrudeGeometryOptions = {
steps: 2,
depth: 10,
bevelEnabled: false,
bevelThickness: 1,
bevelSize: 1,
bevelOffset: 0,
bevelSegments: 1,
};
const geometry = new ExtrudeGeometry(shape, extrudeSettings);
const material = new MeshStandardMaterial({
color: 'blue',
opacity: 0.7,
transparent: false,
});
const location …Run Code Online (Sandbox Code Playgroud)