threejs-app | opinionated structure for a complex/scalable ThreeJS app
kandi X-RAY | threejs-app Summary
kandi X-RAY | threejs-app Summary
Some opinionated structure for a complex/scalable ThreeJS app
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Creates an instance of TriangleCube .
threejs-app Key Features
threejs-app Examples and Code Snippets
Community Discussions
Trending Discussions on threejs-app
QUESTION
How do you do this? I created a scene using the Three.js Editor and downloaded the project using the "Publish" option. I edited the app.js file to import OrbitControls, so now I can use the mouse wheel (or in my case the Apple Magic Mouse 2 trackpad surface) to zoom in/out of the scene. However, I don't want the mouse wheel to zoom, I want it to "scroll" (move the camera up/down along the Y-axis as opposed the Z-axis). Is there a way to do that? Is OrbitControls the way to get there or does that just add complexity? Here is my app.js:
...ANSWER
Answered 2020-Jan-17 at 00:09If vertical scroll is the only behavior you need, then yes, adding OrbitControls
is adding unnecessary complexity because you could easily achieve it with the default JavaScript APIs:
QUESTION
Using the Three.js Editor, I exported a project with a simple scene (two boxes). Everything loads fine—I see the two boxes from my PerspectiveCamera that I added. I want to control my camera view with the mouse wheel. Here is the script in the index.html:
...ANSWER
Answered 2020-Jan-16 at 17:43Alternatively (and even more ideally), is there a way to define the camera behavior I want within the Three.js Editor itself?
Unfortunately no. You can only use the default controls which are defined by EditorControls
, a class similar to OrbitControls
but only used in the editor.
How do I utilize OrbitControls for this?
I'm afraid this is not possible without changing app.js
. The camera and the renderer are created in within APP.Player
and are not public accessible. Since you need both objects for creating OrbitControls
, it's not possible to instantiate the controls in index.html
.
If you decide to change app.js
, use the following code to create the controls if you include OrbitControls
via ES6 imports:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install threejs-app
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page