three.js

Three.js earth and camera turning problems

安稳与你 提交于 2019-12-12 02:15:58
问题 Like this site http://www.gsmlondon.ac.uk/global-oil-map/ I would like to click on this marker, let this marker turn to the center of the screen. Now know the mark latitude and longitude, how to turn after the click? I do not understand. 回答1: Interesting question, I tried Matrix to get right orientation, but the result is a little bit strange. I choose another way using spherical coordinates system, and it works now. we need to get two points coordinates, one is the point on the sphere

Three.js render to texture

假如想象 提交于 2019-12-12 02:09:04
问题 I'm fighting some unexpected behavior. It seems that i can't get anything to render to target. renderer.render( scene , cam , renderTarget , false ); // does not work, empty target either one of these though, will fill the target, this one though renders to frame buffer once renderer.render( scene , cam , renderTarget , false ); renderer.render( scene , cam ); //this somehow causes the renderTarget to be filled or this: renderer.setRenderTarget( renderTarget ); renderer.render( scene , cam ,

Three.js SceneExporter getting Uncaught Syntax error

喜欢而已 提交于 2019-12-12 02:05:11
问题 So I am trying to export a three.js scene using the SceneExporter, I am just doing this var output = new THREE.SceneExporter().parse(scope.renderingEngine.scene); When doing this, I get an error Uncaught SyntaxError: Unexpected token u Which occurs at line 750 of SceneExporter.js (which is the line where the JSON gets parsed; new THREE.SceneExporter().parse(scope.renderingEngine.scene); ) I don't have anything fancy going on in the scene, just a bunch of geometries. I even tried a scene with

Touch events and intersections with crosswalk / three.js on Android 4.0.4 device

烂漫一生 提交于 2019-12-12 01:58:07
问题 I have a crosswalk WebGL_Sample based app that behave correctly on all XDK emulators (I am not using XDK, just testing the EMU's) when I try to touch / intersect a Cube with Three.js's "raycaster.intersectObjects". The problem is that if I shoot it on a real LGP920 running ICS, touch-sliding events are working (like for the sample's sliding cube) but touch-clicking are not whereas, again, everything works fine on EMU's... Any clue about what is happening ? here is what I use (the array

javascript window.addEventListener three.js

[亡魂溺海] 提交于 2019-12-12 01:55:03
问题 I have been trying to create a MyObject.prototype.onWindowResize function to scale a simple cube when the window is resized but am having no luck. Either its appearing as undefined or nothing changing at all. Been searching for quite a while and have not been able to figure this out. Could someone help me please. My many thanks in advance. //OOP THREE //Global Variables var ROTATE_Y = 0.03; //Constructor function Cube() { this.width = window.innerWidth, this.height = window.innerHeight; this

Three.js ctm loader issue of creating a parallel .js file for the .ctm file's reference

依然范特西╮ 提交于 2019-12-12 01:44:36
问题 While working with CTM loader the function requires a .ctm file of object and one .js file, I am able of creating .ctm file of object but I am not able of creating a .js ref file for it in same manner like three.js example file is using it. Can any body help me on this issue? Or if I am making some wrong understanding from the example plz! guide. 回答1: I believe that .ctm file is actually made of multiple .ctm files and combined using the join_ctm.py script (https://github.com/mrdoob/three.js

Raycasting against 'subscenes' in three.js

半世苍凉 提交于 2019-12-12 01:38:31
问题 So I am working with the webgl_interactive_cubes.html in the three.js examples, and I have a relatively simple question: Is it possible to test for intersection of a ray with the children of an object. for example, if I do something like: for ( var i = 0; i < 2000; i ++ ) { var object = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff } ) ); scene.add( object ); } When I call var intersects = raycaster.intersectObjects( scene.children ); It will

three.js: stop automatic rotation while mouse is clicked

此生再无相见时 提交于 2019-12-12 01:38:23
问题 I am playing around with three.js. I built a rotating cube, which you also can rotate around with the help of OrbitControls. Now I am aiming to stop the automatic rotation when the mouse is clicked, so the user won't be distracted when he wants to rotate the cube by himself. So the animation: function animate() { mesh.rotation.x += .015; mesh.rotation.y += .015; mesh.rotation.y += .015; render(); requestAnimationFrame( animate ); } should stop, when mouse is down and continue, when mouse is

Straight tube using tubegeometry

梦想的初衷 提交于 2019-12-12 01:36:43
问题 how can I create a straight tube using TubeGeometry? I can only find examples with curves. 回答1: I ended up looking at the documentation and there were extra parameters that allowed me to set the cylinder open ended or not. As mrdoob said, i also set doubleSided to true so the inside of the cylinder is not showing blank. Edit: sorry forgot to show how I did it using the parameters. THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, segmentsRadius, segmentsHeight, openEnded )

Three js 25000 BoxGeometry 200 models How to increase performance

。_饼干妹妹 提交于 2019-12-12 01:36:16
问题 I am knew to WebGL and Three js having been able to get enough code together to be able to add 25K BoxGeometry Meshes and about 200 models which move simultaneously and interact with the BoxGeometry. I need to be able to move the camera smoothly through these boxes. So, I have tried to merge all the geometry together (got that idea from a google search) and that made the performance worse. I watched several YouTube videos and did not a lot about performance. I am currently using mrdoob-three