Panning Around In THREE.js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Panning Around In THREE.js

I'm playing around with the Javascript library THREE.js. The program provided is below, but the issue is, if you are on mobile it doesn't seem three dimensional as you can't pan around. On computer, I'm using the library FlyControls.js, which uses the keyboard. The question is, how can I alter the program so that you can pan around on mobile, especially since most Sololearn users are using mobile? https://code.sololearn.com/W7kXpDL8moUa/?ref=app

23rd Jan 2020, 9:41 PM
Jianmin Chen
Jianmin Chen - avatar
2 Answers
+ 4
Try simulating keyboard clicks with JavaScript, preferably using jQuery. Then make some virtual buttons, each one triggering a specific keypress (A, S, W...) You can find great examples online. I even remember reading about it in StackOverFlow, start from there.
23rd Jan 2020, 9:48 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
Aymane Boukrouh [INACTIVE], thanks. I was able to do a little Googling and found out about Orbit Controls.js, which allows you to pan around on mobile. Still, I may try your idea of using buttons to simulate the keyboard on another program.
23rd Jan 2020, 10:08 PM
Jianmin Chen
Jianmin Chen - avatar