In A-Frame: How do I get the VR camera

2019-08-19 07:31发布

问题:

In this example:
https://glitch.com/~query-aframe-cameras I have registered a component which launches a projectile in the direction the user is looking (with a little boost for elevation)

Spacebar or Screen Tap to launch - be sure to be looking above the horizon!

It fails in mobile vr (stereo camera) mode:
Projectiles continue to fire, but from the default orientation of the mono, not the stereo camera

I'm using:
var cam = document.querySelector('a-scene').camera.el.object3D; var camVec = new THREE.Vector3(); var camDir = cam.getWorldDirection(camVec); to get the camera information and spit the projectiles back

QUERY: HOW DO I GET THE STEREO CAMERA INFORMATION