diff --git a/src/components/ebike/Ebike.tsx b/src/components/ebike/Ebike.tsx index 3c9e3de..be6488c 100644 --- a/src/components/ebike/Ebike.tsx +++ b/src/components/ebike/Ebike.tsx @@ -10,7 +10,6 @@ import { useDebugFolder } from "@/hooks/debug/useDebugFolder"; import { useEbikeSounds } from "@/hooks/ebike/useEbikeSounds"; import { animateCameraTransformTransition } from "@/world/GameCinematics"; import { useGameStore } from "@/managers/stores/useGameStore"; -import { PLAYER_EYE_HEIGHT } from "@/data/player/playerConfig"; import { EBIKE_CAMERA_TRANSFORM, EBIKE_DROP_PLAYER_TRANSFORM, @@ -76,7 +75,7 @@ export function Ebike({ position }: EbikeProps): React.JSX.Element { // Use ref for internal state, and state for debug visualization (to avoid ref access during render) const restingPositionRef = useRef([ position[0], - position[1] - PLAYER_EYE_HEIGHT, + position[1], position[2], ]); const restingRotationRef = useRef(EBIKE_WORLD_ROTATION_Y); @@ -85,11 +84,23 @@ export function Ebike({ position }: EbikeProps): React.JSX.Element { // State for debug visualization (synced from refs during useFrame) const [showCameraPoints, setShowCameraPoints] = useState(true); const [debugRestingPosition, setDebugRestingPosition] = - useState([ - position[0], - position[1] - PLAYER_EYE_HEIGHT, - position[2], - ]); + useState([position[0], position[1], position[2]]); + + useEffect(() => { + if (movementMode === "ebike") return; + + restingPositionRef.current = position; + restingRotationRef.current = EBIKE_WORLD_ROTATION_Y; + lastGpsUpdatePos.current.set(...position); + + if (groupRef.current) { + groupRef.current.position.set(...position); + groupRef.current.rotation.set(0, EBIKE_WORLD_ROTATION_Y, 0); + } + + window.ebikeParkedPosition = position; + window.ebikeParkedRotation = EBIKE_WORLD_ROTATION_Y; + }, [movementMode, position]); useEffect(() => { if (model) { diff --git a/src/data/ebike/ebikeConfig.ts b/src/data/ebike/ebikeConfig.ts index 0930799..dbefe5e 100644 --- a/src/data/ebike/ebikeConfig.ts +++ b/src/data/ebike/ebikeConfig.ts @@ -15,9 +15,9 @@ export const EBIKE_DROP_PLAYER_TRANSFORM: CameraTransform = { rotation: [0, 0, 0], }; -export const EBIKE_WORLD_POSITION: Vector3Tuple = [55.8, 1.75, 60.2]; -export const EBIKE_WORLD_ROTATION_Y = 2.4107; -export const EBIKE_WORLD_SCALE = 0.25; +export const EBIKE_WORLD_POSITION: Vector3Tuple = [57.9, 6.3, 58.35]; +export const EBIKE_WORLD_ROTATION_Y = -2.5; +export const EBIKE_WORLD_SCALE = 0.35; export const EBIKE_INTRO_BREAKDOWN_DISTANCE = 15; export const EBIKE_BREAKDOWN_DIALOGUE_DELAY_MS = 250; diff --git a/src/world/GameStageContent.tsx b/src/world/GameStageContent.tsx index 016a864..d2a604b 100644 --- a/src/world/GameStageContent.tsx +++ b/src/world/GameStageContent.tsx @@ -14,7 +14,13 @@ import { useRepairMissionAnchorStore } from "@/managers/stores/useRepairMissionA import type { RepairMissionTriggerConfig } from "@/types/gameplay/repairMission"; import type { Vector3Tuple } from "@/types/three/three"; import { getRepairMissionPosition } from "@/utils/gameplay/repairMissionPosition"; -import { EBIKE_WORLD_POSITION } from "@/data/ebike/ebikeConfig"; +import { + EBIKE_WORLD_POSITION, + EBIKE_WORLD_ROTATION_Y, + EBIKE_WORLD_SCALE, +} from "@/data/ebike/ebikeConfig"; + +const EBIKE_CONFIG_KEY = `${EBIKE_WORLD_POSITION.join(",")}:${EBIKE_WORLD_ROTATION_Y}:${EBIKE_WORLD_SCALE}`; interface StageAnchorProps { color: string; @@ -82,7 +88,7 @@ export function GameStageContent(): React.JSX.Element { return ( <> {mainState === "intro" ? : null} - + {REPAIR_MISSION_POSITION_ENTRIES.map(({ mission }) => { const position = getRepairMissionPosition(mission, anchors); if (!position) return null;