mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-03-23 22:29:31 +00:00
improve tours
This commit is contained in:
parent
0736feb4c5
commit
34095f161d
48 changed files with 62 additions and 47 deletions
|
|
@ -125,11 +125,23 @@ function buildCurve(
|
|||
const focus = orbitFocus(animation);
|
||||
const entry = orbitPoint(animation, entryAngle, _v.clone());
|
||||
|
||||
// Midpoint: halfway between start and entry, elevated.
|
||||
const distance = startPos.distanceTo(entry);
|
||||
|
||||
// For short distances, skip the midpoint arc entirely – a direct Catmull-Rom
|
||||
// between start and end gives a smooth enough transition without flying up.
|
||||
if (distance < 20) {
|
||||
return new CatmullRomCurve3(
|
||||
[startPos.clone(), entry],
|
||||
false,
|
||||
"centripetal",
|
||||
);
|
||||
}
|
||||
|
||||
// Midpoint: halfway between start and entry, elevated proportionally.
|
||||
const mid = new Vector3().addVectors(startPos, entry).multiplyScalar(0.5);
|
||||
// Pull midpoint toward the target and elevate.
|
||||
mid.lerp(focus, 0.3);
|
||||
mid.y += Math.max(20, startPos.distanceTo(entry) * 0.15);
|
||||
mid.y += distance * 0.15;
|
||||
|
||||
return new CatmullRomCurve3(
|
||||
[startPos.clone(), mid, entry],
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { BsFillLightningChargeFill } from "react-icons/bs";
|
||||
import { cameraTourStore } from "../state/cameraTourStore";
|
||||
import { useLiveSelector } from "../state/liveConnectionStore";
|
||||
import styles from "./JoinServerButton.module.css";
|
||||
|
||||
|
|
@ -25,6 +26,7 @@ export function JoinServerButton({
|
|||
aria-label={isLive ? "Connected – click to disconnect" : "Join server"}
|
||||
title={isLive ? "Connected – click to disconnect" : "Join server"}
|
||||
onClick={() => {
|
||||
cameraTourStore.getState().cancel();
|
||||
if (isLive) {
|
||||
disconnectServer();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { useCallback, useRef } from "react";
|
||||
import { MdOndemandVideo } from "react-icons/md";
|
||||
import { createLogger } from "../logger";
|
||||
import { cameraTourStore } from "../state/cameraTourStore";
|
||||
import { demoTimelineStore } from "../state/demoTimelineStore";
|
||||
import { liveConnectionStore } from "../state/liveConnectionStore";
|
||||
import { usePlaybackActions, useRecording } from "./RecordingProvider";
|
||||
|
|
@ -25,6 +26,7 @@ export function LoadDemoButton({
|
|||
const scanAbortRef = useRef<AbortController | null>(null);
|
||||
|
||||
const handleClick = useCallback(() => {
|
||||
cameraTourStore.getState().cancel();
|
||||
if (choosingMap && isDemoLoaded) {
|
||||
onCancelChoosingMap?.();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ export function MapInspector() {
|
|||
window.location.hash = "";
|
||||
clearFogEnabledOverride();
|
||||
setChoosingMap(false);
|
||||
cameraTourStore.getState().cancel();
|
||||
// Disconnect from any live server, unload any active recording, and
|
||||
// clear stream state before loading the new mission in map mode.
|
||||
const liveState = liveConnectionStore.getState();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue