Reputation: 43
Sitting on a Study Project right now, building some Scenes in with Aframe. I try to switch between different Cameras in my Aframe Scene, if the User enters a Door to get to the next Scene. I have two of the following Camera Rigs, one for each Scene:
<a-entity id="cameraRig" position="10 4 20">
<a-entity id="head" position="0 2 0" camera="" look-controls="pointerLockEnabled:true">
<a-cursor far="30"></a-cursor>
<a-entity position="0.1 -0.4 0"
raycaster="objects: .selectable; far: 2"
teleport-extras
teleport-controls=
"cameraRig: #cameraRig;
teleportOrigin: #head;
startEvents:starttouch;
endEvents:endtouch;
curveShootingSpeed:30;
hitCylinderRadius:0.3;
collisionEntities: #tele">
</a-entity>
</a-entity>
</a-entity>
This is my Script for changing the Camera:
function Hell() {
document.getElementById('scene1').setAttribute('visible', 'false');
document.getElementById('hell').setAttribute('visible', 'true');
var standartCam = document.querySelector('#head');
standartCam.setAttribute('camera', 'active', false);
var hellCamera = document.querySelector('#head2');
hellCamera.setAttribute('camera', 'active', true);
}
The Switch works until I enter VR-Mode, then the Camera is not switching at all.
I tried to just set a new position for the first CameraRig, but that leads to bugs with the teleport component, where the Camera jumps under the objects it should teleport onto.
How can I get this to work? Thanks for your Help.
Upvotes: 1
Views: 549
Reputation: 43
After hours of try and error, I found the solution. I was using aframe.io/releases/0.8.0. I switched to 0.7.0 and it worked. It also works on 0.8.2.
Upvotes: 0