将对象添加到场景后,如何更新width和height?三.PlaneGeometry(width,height,1,1)

时间:2018-11-13 01:13:27

标签: three.js geometry updating

应用程序显示照片。 用户单击照片时,我想更改其大小和位置 更改位置适用于以下代码: photo.position.y = 700; photo.position.x = 700; 但是我不知道如何使用以下方法更改宽度和高度: 三.PlaneGeometry(width,height,1,1) (我既不想移动相机,也不要移动摄像头)

1 个答案:

答案 0 :(得分:0)

创建Mesh后,您可以修改其scale参数。

var imageGeom = new THREE.PlaneGeometry(1, 1, 1, 1); // Create a 1x1 plane
var imageFrame = new THREE.Mesh(geometry, material); // Build mesh with geometry

// Now you set up the desired dimensions of the resulting mesh
imageFrame.scale.x = 2;
imageFrame.scale.y = 1.5;

这将为您提供按比例放大的网格,其最终尺寸为2 x 1.5。首次创建后,您无需更改PlaneGeometry;为了简单起见,请从1x1开始,然后缩放网格。