threejs球体旋转与场景旋转,Threejs:将球体(球体)旋转到球体本身上的另一个点(城市)...

I'm building a globe(sphere geometry) with set of predefined locations on geo-mapped and drawn as point(sphere geometry). I would like to focus(moving one location to another) those locations by rotating globe along y-axis. I tried the following code, seems not working for all locations.

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;

I think, I don't understand the concept enough. Hopefully, I will get some idea from the community.

解决方案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;

where a= latitude, b= longitude,group=Object3D(or sphere)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值