better initial camera position
This commit is contained in:
parent
e15f831abc
commit
1f607e4a6c
|
|
@ -37,7 +37,7 @@ function setupScene(size: { w: number, h: number }): { scene: THREE.Scene, camer
|
||||||
const scene = new THREE.Scene();
|
const scene = new THREE.Scene();
|
||||||
scene.background = new THREE.Color(0x0a0a12);
|
scene.background = new THREE.Color(0x0a0a12);
|
||||||
|
|
||||||
const camera = new THREE.PerspectiveCamera(55, size.w / size.h, 0.1, 100);
|
const camera = new THREE.PerspectiveCamera(35, size.w / size.h, 0.1, 100);
|
||||||
|
|
||||||
// --- Lights ---
|
// --- Lights ---
|
||||||
scene.add(new THREE.AmbientLight(0xffffff, 0.3));
|
scene.add(new THREE.AmbientLight(0xffffff, 0.3));
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,8 @@ export function useInteraction(
|
||||||
let isRightDrag = false;
|
let isRightDrag = false;
|
||||||
let startX = 0, startY = 0;
|
let startX = 0, startY = 0;
|
||||||
let lastX = 0, lastY = 0;
|
let lastX = 0, lastY = 0;
|
||||||
let azimuth = 0, elevation = 1, radius = 8;
|
let azimuth = -0.8, elevation = 0.45, radius = 10;
|
||||||
let targetPoint = new THREE.Vector3();
|
let targetPoint = new THREE.Vector3(0.5, 0.5, 0);
|
||||||
|
|
||||||
let rotationSpeed = 0.005;
|
let rotationSpeed = 0.005;
|
||||||
|
|
||||||
|
|
@ -56,7 +56,6 @@ export function useInteraction(
|
||||||
const z = targetPoint.z + radius * Math.sin(elevation);
|
const z = targetPoint.z + radius * Math.sin(elevation);
|
||||||
camera.position.set(x, y, z)
|
camera.position.set(x, y, z)
|
||||||
camera.lookAt(targetPoint);
|
camera.lookAt(targetPoint);
|
||||||
console.log(`${formatPoint(camera.position)} ${azimuth} ${elevation}`);
|
|
||||||
}
|
}
|
||||||
updateCamera();
|
updateCamera();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue