簡體   English   中英

Threejs:將球體(球體)旋轉到球體本身上的另一個點(城市)

[英]Threejs: Rotate sphere(globe) to another point(city) on the sphere itself

我正在建立一個地球儀(球體幾何體),並在地理映射上設置了一組預定義位置,並將其繪制為點(球體幾何體)。 我想通過沿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;

我認為,我對這個概念不夠了解。 希望我能從社區中獲得一些想法。

小提琴

var c = group.rotation.y;
var d = -b * (Math.PI / 180)%(2 * Math.PI);
var e = Math.PI / 2 * -1;
group.rotation.y = c % (2 * Math.PI);
group.rotation.x = a * (Math.PI / 180) % Math.PI;
group.rotation.y= d+e;

其中a =緯度,b =經度,group = Object3D(或球面)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM