代码在VR oculus中工作得很好,只是第一人称移动不起作用。我怎么能推销这个问题呢?
controls = new THREE.VRControls( camera );
var fpVrControls = new THREE.FirstPersonVRControls(camera, scene);
fpVrControls.verticalMovement = true;
...
function animate(timestamp) {
vrControls.update(); //when I paste this line scene doesn't work
fpVrControls.update(timestamp); //when I paste this line scene doesn't work
effect.requestAnimationFrame( animate );
render();
}
发布于 2017-05-22 10:02:58
vrControls.update();
至少在这个作用域中,vrControls
是undefined
。在以下代码行中使用controls
:controls = new THREE.VRControls( camera );
,而不是vrControls
。
因此,除非您在代码中的其他地方定义了vrControls
,否则它将抛出一个错误,指出update() is not a function of undefined
。
此外,我看不到您的超文本标记语言,因为您没有包含它,但是THREE.VRcontrols不在核心three.js或three.min.js中,所以您需要手动包含它。它在\examples\js\controls
下的threejs‘s master包中
编辑
请始终检查控制台。它没有被定义,因为它没有加载。
https://stackoverflow.com/questions/44098321
复制