简体   繁体   中英

OOP JavaScript + Three.js: OrbitControls not working

I'm playing a bit around with THREE.js and Object-oriented JavaScript.

Code: https://gist.github.com/BobWassermann/581492be11db361c39ee

My browser displays the correct output, but OrbitControls don't seem to work. Any clue how I can make this work? Spitting up OrbitControls in a function (non-prototype) won't be a solution since I don't pass the variables outside the model.

The error you're having comes from only 1 frame being displayed. You need to make your render loop recursive. You have

requestAnimationFrame(ixmodel.render);

commented out. This is what will allow your updates to be shown. Uncomment that and it should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM