Feat/polish-mission1 #12

Merged
math-pixel merged 42 commits from feat/polish-mission1 into develop 2026-06-01 21:51:09 +00:00
3 changed files with 29 additions and 12 deletions
Showing only changes of commit 597ebcfbd4 - Show all commits
+18 -7
View File
@@ -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<Vector3Tuple>([
position[0],
position[1] - PLAYER_EYE_HEIGHT,
position[1],
position[2],
]);
const restingRotationRef = useRef<number>(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<Vector3Tuple>([
position[0],
position[1] - PLAYER_EYE_HEIGHT,
position[2],
]);
useState<Vector3Tuple>([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) {
+3 -3
View File
@@ -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;
+8 -2
View File
@@ -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" ? <StageAnchor {...INTRO_STAGE_ANCHOR} /> : null}
<Ebike position={EBIKE_WORLD_POSITION} />
<Ebike key={EBIKE_CONFIG_KEY} position={EBIKE_WORLD_POSITION} />
{REPAIR_MISSION_POSITION_ENTRIES.map(({ mission }) => {
const position = getRepairMissionPosition(mission, anchors);
if (!position) return null;