在将对象添加到场景后如何更新宽度,高度? Three.PlaneGeometry(宽度,高度,1,1)

问题描述 投票:0回答:1

该应用程序显示照片。当用户点击照片时,我想更改其大小和位置更改位置使用此代码:photo.position.y = 700; photo.position.x = 700;但我不知道如何改变设置使用的宽度和高度:Three.PlaneGeometry(宽度,高度,1,1)(我不想移动相机或frustrom)

three.js geometry updating
1个回答
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开始,然后缩放网格。

© www.soinside.com 2019 - 2024. All rights reserved.