From d13dd0fda06c9c8d370c515adca30ea609908d0a Mon Sep 17 00:00:00 2001 From: math-pixel <59537610+math-pixel@users.noreply.github.com> Date: Sun, 17 May 2026 12:30:40 +0200 Subject: [PATCH] wip bike movement --- src/components/ebike/Ebike.tsx | 40 ++++++++++++++------------- src/world/GameStageContent.tsx | 2 +- src/world/player/PlayerController.tsx | 7 ++++- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/components/ebike/Ebike.tsx b/src/components/ebike/Ebike.tsx index b42fcd2..dac7b9d 100644 --- a/src/components/ebike/Ebike.tsx +++ b/src/components/ebike/Ebike.tsx @@ -17,7 +17,7 @@ interface CameraTransform { const EBIKE_CAMERA_TRANSFORM: CameraTransform = { position: [-3, 8, 0], - rotation: [0, 90, 0], + rotation: [90, 90, 90], }; const EBIKE_DROP_PLAYER_TRANSFORM: CameraTransform = { @@ -33,7 +33,7 @@ export function Ebike({ position }: EbikeProps): React.JSX.Element { const groupRef = useRef(null); const { scene } = useLoggedGLTF(EBIKE_MODEL_PATH, { scope: "Ebike", - position: [0, 0, 0], + position: position, }); const model = useClonedObject(scene); const movementMode = useGameStore((state) => state.player.movementMode); @@ -94,22 +94,24 @@ export function Ebike({ position }: EbikeProps): React.JSX.Element { }; return ( - - - - - - - - + <> + + + + + + + + + {debugRef.current.showCameraPoints && ( <> @@ -130,6 +132,6 @@ export function Ebike({ position }: EbikeProps): React.JSX.Element { )} - + ); } diff --git a/src/world/GameStageContent.tsx b/src/world/GameStageContent.tsx index e31b163..359b2a4 100644 --- a/src/world/GameStageContent.tsx +++ b/src/world/GameStageContent.tsx @@ -57,7 +57,7 @@ export function GameStageContent(): React.JSX.Element { {mainState === "intro" ? ( ) : null} - + {GAME_REPAIR_ZONES.map((zone) => ( state.missionFlow.canMove); const currentSpeed = useGameStore((state) => state.player.currentSpeed); const movementMode = useGameStore((state) => state.player.movementMode); + const movementModeRef = useRef(movementMode); + + useEffect(() => { + movementModeRef.current = movementMode; + }, [movementMode]); const capsule = useRef(createSpawnCapsule(spawnPosition)); @@ -283,7 +288,7 @@ export function PlayerController({ } } - if (movementMode !== "ebike") { + if (movementModeRef.current !== "ebike") { camera.position.copy(capsule.current.end); } });