Open Perhelion opened 6 years ago
Up! That would be great. I've been able to simulate the "look-at" swapping the orbit-controls.target value:
AFRAME.registerComponent( 'mytest-click', {
schema: {
active: { type: "boolean" }
},
init: function () {
var data = this.data;
var el = this.el;
el.addEventListener( 'click', function ( evt ) {
// Calculate real position
var targetPosition = new THREE.Vector3();
targetPosition.setFromMatrixPosition( evt.target.object3D.matrixWorld );
var cameraPosition = document.querySelector( '#camera' ).getAttribute( 'position' );
// camera height offset
targetPosition.y -= cameraPosition.y;
var currOrbit = document.querySelector( '#camera' ).getAttribute( 'orbit-controls' );
currOrbit.target = targetPosition;
document.querySelector( '#camera' ).setAttribute( 'orbit-controls', currOrbit );
} );
}
});
..I only need to understand how to animate the thing and to "move" the camera to another position
Hi,
Here is a patch in which I have the rotateTo functionality available for three views: front, side and top. This can be changed by managing the azimuth and polar angles as desired in the rotateTo function. rotateTo.patch.txt
Could this function be added from the old https://github.com/tizzle/aframe-orbit-controls-component/ !?