Skip to content
Snippets Groups Projects
Commit 523b4d6a authored by joni's avatar joni
Browse files

change virtual gamepad controls to emit move event

parent 0dc19032
No related branches found
No related tags found
No related merge requests found
......@@ -57,11 +57,9 @@ AFRAME.registerComponent("virtual-gamepad-controls", {
var force = joystick.force < 1 ? joystick.force : 1;
var x = Math.cos(angle) * force;
var z = Math.sin(angle) * force;
this.el.sceneEl.emit("translateX", { value: x });
this.el.sceneEl.emit("translateZ", { value: z });
this.el.sceneEl.emit("move", { axis: [x, z] });
} else {
this.el.sceneEl.emit("translateX", { value: 0 });
this.el.sceneEl.emit("translateZ", { value: 0 });
this.el.sceneEl.emit("move", { axis: [0, 0] });
}
} else {
if (event.type === "move") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment