【发布时间】:2016-09-09 23:41:33
【问题描述】:
我正在使用 WebRTC(网络摄像头访问)、JSARToolKit(标记检测)和threeJS(3D 库)开发一个 AR 应用程序。
我想将 3D 对象(使用 threejs maya 导出器从 Maya 导出)放置在检测到的标记的中心。
这是我使用 JSONLoader 加载 3D 对象的代码:
// load the model
var loader = new THREE.JSONLoader;
var object;
//var geometry = new THREE.BoxGeometry(1, 1, 1);
loader.load('js/cube.js', function(geometry, materials){
var material = new THREE.MeshFaceMaterial(materials);
object = new THREE.Mesh(geometry, material);
object.position.x -= ***3DobjectWidth/2***;
object.position.y -= ***3DobjectHeight/2***;
object.position.z -= ***3DobjectDepth/2***;
scene.add(object);
});
我需要获取对象的宽度、高度和深度来改变他的位置(参见3DobjectWidth ecc)。
有什么建议吗?
【问题讨论】:
标签: json 3d three.js maya dimension