Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Aframe 将动态观察控制目标设置为平移结束位置_Aframe_Target_Pan - Fatal编程技术网

Aframe 将动态观察控制目标设置为平移结束位置

Aframe 将动态观察控制目标设置为平移结束位置,aframe,target,pan,Aframe,Target,Pan,我正在使用带框架的轨道控制。当我平移对象,然后使用左键单击旋转它时,它不会围绕其新中心旋转。它仍然围绕0,0,0旋转 如何实现为动态观察控件设置新目标,以便当用户平移然后旋转/缩放时,相机应围绕新目标旋转和缩放 我是新来的一个框架和三个js。以下是我用有限的知识到目前为止所做的尝试 var entity_3dModel=document.createElement(“a-entity”); 场景.追加子对象(实体\三维模型); 实体3dModel.setAttribute(“修改材质”和“”)

我正在使用带框架的轨道控制。当我平移对象,然后使用左键单击旋转它时,它不会围绕其新中心旋转。它仍然围绕0,0,0旋转

如何实现为动态观察控件设置新目标,以便当用户平移然后旋转/缩放时,相机应围绕新目标旋转和缩放

我是新来的一个框架和三个js。以下是我用有限的知识到目前为止所做的尝试

var entity_3dModel=document.createElement(“a-entity”);
场景.追加子对象(实体\三维模型);
实体3dModel.setAttribute(“修改材质”和“”);
实体3dModel.setAttribute(“单击“,”);
实体_3dModel.setAttribute(“gltf模型”,“url”('+models_路径[当前学习编号]+'));
实体3dumodel.setAttribute('比例',“1”);
实体3dModel.setAttribute(“id”、“模型”);
实体3dModel.setAttribute(“阴影”、“投射:真”);
实体3dModel.setAttribute(“位置”,“0”);
实体3dModel.setAttribute(“类”,“可单击”);
实体3dModel.setAttribute(“光标”、“光线原点:鼠标”);
实体3dModel.setAttribute(“调试游标”、“true”);
实体3dModel.setAttribute(“foo”,即“”);
AFRAME.registerComponent(“foo”{
init:function(){
this.el.addEventListener('mousedown',(captureEvent)=>{
$(文档).on(“上下文菜单”,this.el.object3D,函数(e){
if(captureEvent.detail.intersection)
PannedPointStart=新的三个.Vector3(captureEvent.detail.intersection.point.x,captureEvent.detail.intersection.point.y,
captureEvent.detail.intersection.point.z);
log('PannedPointStart'+PannedPointStart);
e、 预防默认值();
});
});
this.el.addEventListener('mouseup',(captureEventup)=>{
$(文档).on(“上下文菜单”,this.el.object3D,函数(e){
if(captureEventup.detail.intersection)
PannedPointEnd=新的3.Vector3(captureEventup.detail.intersection.point.x,
captureEventup.细节.交叉点.点.y,
captureEventup.detail.intersection.point.z);
//log('Context Menu event has fired!'+captureEventup.detail.intersection.point.x);
log('PannedPointEnd'+PannedPointEnd');
如果(PannedPointStart!=PannedPointEnd)
ChangeTarget(PannedPointEnd);
e、 预防默认值();
});
});
},
删除:函数(){
此.el.remove('mousedown');
此.el.remove('mouseup');
}
});
功能更改目标(中心点){
document.querySelector(“#camera”).setAttribute('orbit-controls','target',centerPoint);
}