three.js

How to include OVRManager in Three.js Scene?

六眼飞鱼酱① 提交于 2019-12-12 20:06:45
问题 I have created several Three.js/Javascript demo applications that I'm experimenting with in my new Oculus Go. I'm trying to enable the Go Controller to do stuff in my applications, and according to the Oculus Developer Center, the best thing to do is to include OVRManager in my scene so I have access to that API. That sounds good, but for all the documentation (https://developer.oculus.com/documentation/unity/latest/concepts/unity-ovrinput/) I can't see HOW to add OVRManager to my scene! I

Transitions between panoramas in Three.js

时间秒杀一切 提交于 2019-12-12 19:41:03
问题 I have set of equirectangular panorama pictures, I'm displaying them using Three.js sphere geometry similar to this example: http://mrdoob.github.io/three.js/examples/webgl_panorama_equirectangular.html I added buttons to the scene to allow navigation between panoramas. I would like to have transition while traveling between panoramas. It should be similar to Google Street View transitions as much as possible. Can someone share some ideas/directions how to implement this using three.js? 来源:

What is the benefit of using extend on the prototype in three.js inheritance pattern?

耗尽温柔 提交于 2019-12-12 19:25:35
问题 Working with the excellent Three.js framework and currently looking for a good javascript inheritance pattern, I had a look to what is done in Three.js. I now have a good understanding of what's going on, except for some "class" such as Vector3. Especially, it's not clear for me, why some methods are directly added to the prototype and some are added using THREE.extend in the same "class" , like following : ... THREE.Vector3.prototype = { setX: function ( x ) { this.x = x; return this; }, ...

Texture issue while using THREE.TextureLoader over deprecated THREE.ImageUtils.loadTexture

☆樱花仙子☆ 提交于 2019-12-12 18:55:03
问题 I was using this function to add Texture on a Cylinder. function createElementMaterial() { THREE.ImageUtils.crossOrigin = ''; var t = THREE.ImageUtils.loadTexture( IMG_MACHINE ); t.wrapS = THREE.RepeatWrapping; t.wrapT = THREE.RepeatWrapping; t.offset.x = 90/(2*Math.PI); var m = new THREE.MeshBasicMaterial(); m.map = t; return m; } which is working and adds Texture, but in console it sets a warning message. THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.

How to make a Clickable CSS3DObject

心已入冬 提交于 2019-12-12 18:26:16
问题 I'm using THREE JS CSS3DRenderer - trying to make a CSS3DObject update it's position.z on click. Here's my code: var element = document.createElement( "div" ); element.style.width = "90px"; element.style.height = "120px"; element.style.backgroundColor = "#5C6167"; // var object = new THREE.CSS3DObject( element ); object.position.x = 0; object.position.y = 0; object.position.z = 100; object.addEventListener( 'click', function ( event ) { new TWEEN.Tween( object.position ).to( {z: 200}, 500 )

Three.js How to make a camera follow a terrain heightmap?

走远了吗. 提交于 2019-12-12 18:25:54
问题 I have a terrain mountain range with a camera fly view positioned close to the heightmap. The camera is controlled using standard keyboard controls that doesn't allow movement in y axis; it stays on it's set y-axis. Since the terrain is not an even level and randomly renders. How can I get the camera to follow the terrain heightmap? Here is an example. Below is an attempt to add raycaster to scale over the terrain. All code is in the animate function in project. I noticed that when the camera

Three.js project crashes mobile

混江龙づ霸主 提交于 2019-12-12 18:22:50
问题 I've been working on a three.js project to try and learn the framework. Got a basic model floating around that works fine on the desktop browser but will crash repeatedly on mobile. I uploaded the project on my server http://threedeesneaker.404vanity.com/ Is there any way to optimize this for mobile devices? I tried both chrome and safari for iPhone and iPad. The code it self: (function() { var scene, camera, renderer; var geometry, material, mesh, sneaker; init(); animate(); function init()

camera rotates pointerlockcontrols

空扰寡人 提交于 2019-12-12 17:25:12
问题 I have used mrdoob's PointerLockControls.js example for this project. Everything works fine until I change the camera.position.set(2, 2, 3 ); to this camera.position.set(1100, 150, -50 ); It seems to 'rotate' along the z axis instead of just looking. 回答1: You need to do this: controls.getObject().position.set( 1100, 150, -50 ); This is because of the clever way PointerLockControls handles camera movement. 来源: https://stackoverflow.com/questions/15191742/camera-rotates-pointerlockcontrols

orbitcontrols.js: How to Zoom In/ Zoom Out

时光总嘲笑我的痴心妄想 提交于 2019-12-12 17:16:09
问题 Using orbitcontrols.js (with THREE.js), I want to achieve the same effect in code as rotating the mouse wheel. For example, I want to call something like camera.zoomIn() and have it move a set distance toward the target. Anyone know how to do this? 回答1: From looking at the source code you can call .dollyIn(dollyScale) and .dollyOut(dollyScale) on the OrbitalControls object. Edit: these aren't public methods; one can access them by editing OrbitalControls.js though. I added this.dIn = dollyIn;

Three js, get the vector3 that pointerlockcontrolsi s facing

核能气质少年 提交于 2019-12-12 16:36:40
问题 Wondering if it's possible to get the way the yaw object in pointer lock controls is facing and use that as a direction for a raycaster. I've been toying around with the code, trying to add some basic shooter stuff to it. I've been trying a few things i've found on stack overflow with the X & Y values from the yaw object the pointer controls provides, but no luck. Here's what I have so far: setupTarget: function() { //var vector = new THREE.Vector3(game.mouse.x, game.mouse.y, 0); var yaw =