优化银河相机视角

This commit is contained in:
2026-05-26 02:24:10 +08:00
parent 930291f367
commit ad483ced11
2 changed files with 9 additions and 4 deletions
+5 -1
View File
@@ -469,6 +469,7 @@ export function createTravelScene(container: HTMLElement): TravelSceneController
galaxyGroup.position.z = APP_CONFIG.galaxy.zPosition
galaxyGroup.rotation.x = APP_CONFIG.galaxy.tiltX
galaxyGroup.rotation.y = APP_CONFIG.galaxy.tiltY
galaxyGroup.rotation.z = APP_CONFIG.galaxy.tiltZ
scene.add(galaxyGroup)
const galaxyGeometry = new THREE.PlaneGeometry(APP_CONFIG.galaxy.width, APP_CONFIG.galaxy.height, 1, 1)
@@ -844,9 +845,12 @@ export function createTravelScene(container: HTMLElement): TravelSceneController
travelRoot.position.y = -viewY * 1.0
// 加大相机的偏移幅度和观察点偏移
// 增加一点默认偏移,让相机的中心略微向左上,从而使画面整体偏向右下,填补空旷
const baseLookX = -3.0
const baseLookY = 5.0
camera.position.x = viewX * APP_CONFIG.interaction.maxOffset * 4.5
camera.position.y = viewY * APP_CONFIG.interaction.maxOffset * 3.0
camera.lookAt(viewX * 2.5, viewY * 1.5, -30)
camera.lookAt(baseLookX + viewX * 2.5, baseLookY + viewY * 1.5, -30)
renderer.render(scene, camera)
animationFrameId = window.requestAnimationFrame(render)