【发布时间】:2015-11-03 05:08:54
【问题描述】:
我正在构建一个地球(球体几何),其中包含一组预定义的地理映射位置并绘制为点(球体几何)。我想通过沿 y 轴旋转地球来聚焦(将一个位置移动到另一个位置)这些位置。我尝试了以下代码,似乎不适用于所有位置。
location.geometry.computeBoundingBox();
var position = new THREE.Vector3();
position.subVectors( location.geometry.boundingBox.max, location.geometry.boundingBox.min );
position.multiplyScalar( 0.20 );
position.sub( location.geometry.boundingBox.min );
location.matrixWorld.multiplyVector3( position );
var point1 = scene.clone().position;
var point2 = position;
var distance = point1.distanceTo( point2 );
locationCollection.rotation.y = distance;
我想,我对这个概念的理解不够。希望我能从社区中得到一些想法。
【问题讨论】:
-
你能创建一个小提琴 (jsfiddle.net) 来显示你的代码的工作版本吗?
-
我已经创建了小提琴。多一点代码。我已经为代码块编写了一些简短的 cmets。希望它实现了目的。下面是小提琴链接,jsfiddle.net/senthanal/j7mda/25
标签: javascript 3d three.js webgl