Open ningacoding opened 2 years ago
Hi @ningacoding,
The touch event should have enough data in its payload to help you determine direction. Something like:
touches.filter(t => t.type === "move").forEach(t => {
let finger = entities[t.id];
if (finger && finger.position) {
finger.position = [
finger.position[0] + t.delta.pageX,
finger.position[1] + t.delta.pageY
];
}
});
For something with a little more functionality, you can take a look at the Gamepad Controller System from the template project.
Hope that helps!
Hi @bberak , thank you for your answer.
with Gamepad Controller System, How i detect "up", "left", "down", "right" events?
I just need to call dispatch("up") to fire event, but i don't under stand the code inside gamepad-controler.
I already added the component into my App:
But i don't understand how it works, I move the D-Pad, it just turns from transparent to white and viceversa. I don't see D-Pad move.
Hi @bberak , thank you for your answer.
with Gamepad Controller System, How i detect "up", "left", "down", "right" events?
I just need to call dispatch("up") to fire event, but i don't under stand the code inside gamepad-controler.
I already added the component into my App:
But i don't understand how it works, I move the D-Pad, it just turns from transparent to white and viceversa. I don't see D-Pad move.
Hi,Could you please help me how can i add the gamepad-controller into my own project. i have tried it serval times,but it dose not work
Hello, what's the best Way to handle touch user input? in order to build a simple directional (up,right,down,left) control.
The touches only have type 'move', 'long-press', etc.
Is there a Way the touches gives the orientation natively?
Adding event types like 'move-left', etc.