从 Blender 导出的 json 对象中操作 Three.js 中的 3 个维度
Manipulate the 3 Dimensions in Three.js from json object exported by Blender
我想知道是否有办法让用户从我的网站手动操作由 Blender 创建并由此 exporter 以 json 格式导出的 3d 对象。
我希望用户更改对象的长度宽度高度。
例如,我有这个简单的立方体 json 格式
{
"metadata": {
"generator": "io_three",
"type": "Geometry",
"vertices": 8,
"faces": 6,
"uvs": 0,
"normals": 8,
"version": 3
},
"uvs": [],
"name": "CubeGeometry",
"faces": [33,0,1,2,3,0,1,2,3,33,4,7,6,5,4,5,6,7,33,0,4,5,1,0,4,7,1,33,1,5,6,2,1,7,6,2,33,2,6,7,3,2,6,5,3,33,4,0,3,7,4,0,3,5],
"normals": [0.577349,-0.577349,-0.577349,0.577349,-0.577349,0.577349,-0.577349,-0.577349,0.577349,-0.577349,-0.577349,-0.577349,0.577349,0.577349,-0.577349,-0.577349,0.577349,-0.577349,-0.577349,0.577349,0.577349,0.577349,0.577349,0.577349],
"vertices": [1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,0.999999,1,1,-1,1,1,-1,1,-1]
}
并且我希望用户能够通过在表单中键入数字而不是鼠标药物来更改 3 个维度。
谢谢!
好的,我找到了。如果有人想知道解决方案是
var model = new THREE.Object3D();
model.add(object);
model.scale.set(x,y,z);
其中 object 是你的对象 :p
我想知道是否有办法让用户从我的网站手动操作由 Blender 创建并由此 exporter 以 json 格式导出的 3d 对象。 我希望用户更改对象的长度宽度高度。 例如,我有这个简单的立方体 json 格式
{
"metadata": {
"generator": "io_three",
"type": "Geometry",
"vertices": 8,
"faces": 6,
"uvs": 0,
"normals": 8,
"version": 3
},
"uvs": [],
"name": "CubeGeometry",
"faces": [33,0,1,2,3,0,1,2,3,33,4,7,6,5,4,5,6,7,33,0,4,5,1,0,4,7,1,33,1,5,6,2,1,7,6,2,33,2,6,7,3,2,6,5,3,33,4,0,3,7,4,0,3,5],
"normals": [0.577349,-0.577349,-0.577349,0.577349,-0.577349,0.577349,-0.577349,-0.577349,0.577349,-0.577349,-0.577349,-0.577349,0.577349,0.577349,-0.577349,-0.577349,0.577349,-0.577349,-0.577349,0.577349,0.577349,0.577349,0.577349,0.577349],
"vertices": [1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,1,-1,0.999999,1,1,-1,1,1,-1,1,-1]
}
并且我希望用户能够通过在表单中键入数字而不是鼠标药物来更改 3 个维度。
谢谢!
好的,我找到了。如果有人想知道解决方案是
var model = new THREE.Object3D();
model.add(object);
model.scale.set(x,y,z);
其中 object 是你的对象 :p