Spaces:
Running
Running
File size: 721 Bytes
213d393 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import { POSE, type SceneState } from './model'
import type { V3 } from './math'
export function baseState(over: Partial<SceneState> = {}): SceneState {
return {
cam: { pos: [0, 0.2, 5], target: [0, 0.2, 0], fov: 35 },
arm: { pos: [0, 0, 0], rot: [0, 0.6, 0] },
pose: [...POSE.rest],
skin: 1, xray: 0, bone: 0, tendon: 0, sheath: 0, thick: 0, friction: 0, pain: 0,
props: {},
time: 0,
...over,
}
}
/** camera orbiting helper: spherical around target */
export function orbit(target: V3, dist: number, yaw: number, pitch: number): V3 {
return [target[0] + dist * Math.sin(yaw) * Math.cos(pitch), target[1] + dist * Math.sin(pitch), target[2] + dist * Math.cos(yaw) * Math.cos(pitch)]
}
|