pointerlock

Three.js Pointerlockcontrols shooting along y-axis

怎甘沉沦 提交于 2019-12-12 03:14:05
问题 Currently I am developing a FPS with three.js and pointerlockcontrols. Using the code below I can shoot into any horizontal direction: var direction = new THREE.Vector3( 0, 0, -1 ); var rotation = new THREE.Euler( 0, 0, 0, "XYZ" ); var cameraDirection = new THREE.Vector3(this.game.usermodel.root.children[0].position.x, this.game.usermodel.root.children[0].rotation._x, this.game.usermodel.root.children[0].position.z); cameraDirection.copy( direction ).applyEuler( this.game.user.rotation ); var