Open Turtleted21 opened 3 years ago
I created 2 components like this, it work : `
// need to run javascript code after a-scene entities and components are loaded
AFRAME.registerComponent('screen-controls',
{
init: function ()
{
this.component1 = document.getElementById("cameraRig").components["extended-wasd-controls"];
this.component2 = document.getElementById("cameraHead ").components["extended-wasd-controls"];
this.joystick1 = new Joystick("stick1", 64, 8);
this.joystick2 = new Joystick("stick2", 64, 8);
},
tick: function(time, deltaTime)
{
// console.log( joystick1.value )
// console.log( this.component.movePercent )
this.component1.movePercent.x = this.joystick1.value.x;
this.component1.movePercent.z = -this.joystick1.value.y;
this.component2.rotatePercent.x = -this.joystick2.value.y;
this.component2.rotatePercent.y = -this.joystick2.value.x;
}
});
</script>`
what do you think about my code? thanks
ah it don't work, my move is "absolute", it don't take take into account the rotate coming from the joystick2.
Hello Your examples show how to use extended-wasd-controls with one camera. My project is setting with 2 cameras entity, a cameraRig to move and a cameraHead to look. ( because can work in VR too ) How I can set extended-wasd-controls to control cameraRig/move with a joystick and cameraHead/look with another joystick ?
Thanks