Exploring the possibilities of creating A-Frame applications, I decided to dive into the world of A-Frame Dominoes. In my current project, objects are spawned in response to the Vive trigger being pressed.
While I have successfully managed to align the position of the newly created object with that of the Vive controller at trigger activation, I am facing challenges when it comes to matching the rotation of the new object with that of the controller.
I have attempted the following approach:
onTriggerDown: function () {
var sceneEl = d3.select(this.el.sceneEl);
var controllerWorldPosition = this.el.object3D.getWorldPosition();
var controllerWorldRotation = this.el.object3D.getWorldRotation();
sceneEl.append('a-obj-model')
.attr('id', 'base-street-children')
.attr('scale', '0.01 0.01 0.01')
.attr('position', controllerWorldPosition)
.attr('rotation', controllerWorldRotation)
.attr('src', '#base-street-obj')
.attr('mtl', '#base-street-mtl');
},
I am wondering if there is a specific method or technique in JavaScript for setting the rotation of a new object that I might be overlooking?