![]() tSize( window.innerWidth, window.innerHeight ) Ĭontainer = document.getElementById( 'container' ) Ĭontainer.appendChild( renderer.domElement ) texture - texture must not be in same folder or there is an error. Light = new THREE.AmbientLight( 0x222222 ) Light = new THREE.DirectionalLight( 0x002288 ) Light = new THREE.DirectionalLight( 0xffffff ) Var windowHalfY = window.innerHeight / 2 Ĭamera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 10000 ) Finally I decided to take this example and tweak it a bit. The Orbit Controls example has the right kind of navigation, but lacks the mouse momentum. Other examples like this one have the above, but would only rotate as far as the screen would allow the mouse to go hence you couldn’t spin an object around. I wanted a stable view plane while navigating. The examples on the three.js website accomplish something close… The trackball example seems to accomplish the smooth mouse tracking, but the only problem is that the camera tilts in all directions when navigating. The problem I found though is that from the examples that use it, it was difficult to find proper source code that worked just how I wanted it. After experimenting with three.js and seeing it’s potential I thought this is a must have feature. It is based off of this post and this example on the three.js website.Īchieving a momentum effect during mouse drag has always been a nice feature that I’ve see many times in different examples of 3D for the web. This example demonstrates Smooth axis rotation via mouse in three.js.
0 Comments
Leave a Reply. |