-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lesson 1: Adding touch to the Controls class? #8
Comments
I think that what you describe should work... How are you testing these changes? |
Thank you for your fast reply. Here’s the complete file
|
Looks like you're not calling the private method: |
Changed that (and my misspelled „document“) but no touch is recognized. Update: Tested on laptop and keys also not working. I’m sorry, I’ll check for mistakes in all files myself and let you know the result. |
So, with the additional brackets, it works with keys on the computer. But with the touch function in the laptop browser there’s also no reaction… |
It’s possible to ignore the touch events and solve it with mouse events that are working on mobile but for steering controls it would be much better to get multiple touches to drive and steer at the same time like it’s done with the keys. |
I want to add mobile controls by touch and I tried to add
document.ontouchstart = (event) => {}
and alsothis.canvas. ontouchstart = (event) => {}
(by adding the canvas object to Car and then to Controls). But both didn’t work. Checked that by puttingconsole.log(event);
and/orthis.forward = true;
inside the above functions.Could anyone help me to get that work and especially learn what I did wrong?
Thank you.
The text was updated successfully, but these errors were encountered: