【发布时间】:2022-02-08 20:33:58
【问题描述】:
我使用旋转的three.js 创建了一个3D 地球,但问题是它开始在海洋上空旋转。 我尝试使用 matrixWorld 更改起始位置,但没有更改任何内容 有人可以帮忙吗? 这是我的js:
... const earthgeometry = new THREE.SphereGeometry(0.344,64,32);
const eatrhmaterial = new THREE.MeshPhongMaterial({
roughness: 1,
metalness:0,
map: THREE.ImageUtils.loadTexture('static/img/earthmap1k.jpg'),
bumpMap: THREE.ImageUtils.loadTexture('static/img/earthbump.jpg'),
bumpScale: 0.3,
});
const earthmesh = new THREE.Mesh(earthgeometry,eatrhmaterial);
earthmesh.position.set (0.49,0.035,0.58);
earthmesh.matrixWorld.setPosition(new THREE.Vector3(100, 100, 100));
...
【问题讨论】:
-
设置 Y 轴旋转的初始值为 Math.PI * 0.5,例如。
earthmesh.rotation.y = Math.PI * 0.5; -
你能详细说明一下这个问题吗?它从哪个海洋开始旋转,你有截图吗?我假设你正在旋转你的地球材料,并且你有一个海洋的辅助球体
-
嗨@Mouhcin,如果这个或任何答案解决了您的问题,请点击复选标记考虑accepting it。这向更广泛的社区表明您已经找到了解决方案,并为回答者和您自己提供了一些声誉。没有义务这样做。
标签: three.js