I made this project:
Is there an explanation why my keyboard controls aren’t working? If so, is there an easy way to fix it?
I made this project:
Is there an explanation why my keyboard controls aren’t working? If so, is there an easy way to fix it?
I think you run in the same problem like mentioned in the following topic. I’ve posted a possible solution right here: Want to let car ‘drive’ but that doesn’t work, instead the camera moves
I don’t think so. In that case I was interfering with the OrbitControls. With this project things run fine when I run it locally from my computer into Chrome. But when I load it into CodePen the keys won’t work anymore
If you disable the controls they work:
But I need the orbit and zoom controls. Just nog the arrow keys. So I thought I could do this in the JS editor:
controls.enablePan = false;
controls.enableKeys = false;
It disables the pan and the keys, but my keys still won’t work.
Even if you set enableKeys
to false, the respective event listeners are already set and active. Hence, you have to enhance OrbitControls
to make this work.
I also tried to change it in the orbitcontrols.js file itself. When I run it local it works. Then I upload it to github to link it in codepen (RAW in html editor of codepen) But that doesn’t work
Is the version on RAW equal to your local version?
Yep. Except I link to it from GitHub. So the only possibility is that I link it the wrong way? I just put the RAW URL in the HTML editor with the rest of the scripts
Refused to execute script from ‘https://raw.githubusercontent.com/biancalooijen/projectInteractiveHome/master/OrbitControls.js’ because its MIME type (‘text/plain’) is not executable, and strict MIME type checking is enabled.
This is the error I get in the console when adding my GitHub link to the HTML editor on CodePen.