最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to control camera both with keyboard and mouse - three.js - Stack Overflow

programmeradmin1浏览0评论

I have a 3D enviroment in WEB GL with three.js and I used to use orbitcontrols.js ( like this project) to move the point of view. Now I saw a nice way to move inside the enviroment with W A S D keys (.js/Chase-Camera.html) like in an FPS (but not with pointerlocking etc) also using orbitcontrols.js . The problem is that when I impelmentes the last functionality, I lost the first functionality with the mouse (I removed the controls.update() and I used the customa update() on the link).

My question is if and how can I have both functionalities at the same time. Both Keys and mouse moving the camera.

thanks

I have a 3D enviroment in WEB GL with three.js and I used to use orbitcontrols.js (http://codepen.io/nireno/pen/cAoGI like this project) to move the point of view. Now I saw a nice way to move inside the enviroment with W A S D keys (http://stemkoski.github.io/Three.js/Chase-Camera.html) like in an FPS (but not with pointerlocking etc) also using orbitcontrols.js . The problem is that when I impelmentes the last functionality, I lost the first functionality with the mouse (I removed the controls.update() and I used the customa update() on the link).

My question is if and how can I have both functionalities at the same time. Both Keys and mouse moving the camera.

thanks

Share Improve this question asked May 8, 2014 at 21:53 ovelix123ovelix123 2051 gold badge2 silver badges7 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

I think you want something like this: https://github./mrdoob/three.js/blob/master/examples/js/controls/PointerLockControls.js

Found from this SO question: Three.js First Person Controls

发布评论

评论列表(0)

  1. 暂无评论