I want to constantly move the view of my Aframe scene in the current viewing direction.
There seem to be two components for this: (1) getting the current viewing direction in the correct format, (2) determining and updating continuous animation with the current viewing direction of the camera.
I managed to get the camera viewing direction using the following code:
<script>
AFRAME.registerComponent('listener', {
tick: function () {
var position = this.el.getAttribute('position');
var rotation = this.el.getAttribute('rotation');
}
});
</script>
How to create an animation that moves in the direction of viewing the camera, for example, with the current tilt?
I tried this for a move:
AFRAME.registerComponent('listener', {
tick: function () {
var camp = document.querySelector("#cameraWrapper");
camp.setAttribute('position', camp.getAttribute('position').add(0.1)););
}
});
source
share