Is there a way to continuously adjust the view of my Aframe scene based on the current viewing direction?
It seems like there are two key components needed for this: (1) obtaining the current viewing direction in the correct format, and (2) creating and updating a continuous animation that aligns with the camera's viewing direction.
I was able to retrieve the camera's viewing direction using this code snippet:
<script>
AFRAME.registerComponent('listener', {
tick: function () {
var position = this.el.getAttribute('position');
var rotation = this.el.getAttribute('rotation');
}
});
</script>
Now, how can I generate an animation that moves according to the camera's viewing angle, perhaps adjusting with the current tilt?
I attempted the following approach for motion:
AFRAME.registerComponent('listener', {
tick: function () {
var camp = document.querySelector("#cameraWrapper");
camp.setAttribute('position', camp.getAttribute('position').add(0.1)););
}
});