Feat: Add path terrain glue and offset controls

This commit is contained in:
2026-05-12 23:34:58 +02:00
parent 575675d7fc
commit 552f19a7f5
2 changed files with 37 additions and 1 deletions

View File

@@ -239,6 +239,7 @@ import {
getScenePathPointIndex,
getScenePaths,
normalizeScenePathSampledResolution,
normalizeScenePathTerrainOffset,
normalizeScenePathName,
type ScenePath,
type ScenePathCurveMode,
@@ -9605,6 +9606,8 @@ export function App({
loop: selectedPath.loop,
curveMode: selectedPath.curveMode,
sampledResolution: selectedPath.sampledResolution,
glueToTerrain: selectedPath.glueToTerrain,
terrainOffset: selectedPath.terrainOffset,
points: selectedPath.points.map((point, index) => ({
id: point.id,
position: readVec3Draft(
@@ -9676,6 +9679,40 @@ export function App({
commitPathChange(selectedPath, nextPath, "Updated Path spline resolution.");
};
const handlePathGlueToTerrainChange = (glueToTerrain: boolean) => {
if (selectedPath === null) {
setStatusMessage("Select a path before changing terrain glue.");
return;
}
const nextPath = createScenePath({
...selectedPath,
glueToTerrain
});
commitPathChange(
selectedPath,
nextPath,
glueToTerrain
? "Enabled Path terrain glue."
: "Disabled Path terrain glue."
);
};
const handlePathTerrainOffsetChange = (terrainOffset: number) => {
if (selectedPath === null) {
setStatusMessage("Select a path before changing terrain offset.");
return;
}
const nextPath = createScenePath({
...selectedPath,
terrainOffset: normalizeScenePathTerrainOffset(terrainOffset)
});
commitPathChange(selectedPath, nextPath, "Updated Path terrain offset.");
};
const handlePathPointDraftChange = (
pointIndex: number,
axis: keyof Vec3Draft,

View File

@@ -79,7 +79,6 @@ import {
MAX_SCENE_PATH_SAMPLED_RESOLUTION,
MIN_SCENE_PATH_POINT_COUNT,
MIN_SCENE_PATH_SAMPLED_RESOLUTION,
normalizeScenePathTerrainOffset,
isScenePathCurveMode,
type ScenePath
} from "./paths";