feat: change grid view distance

This commit is contained in:
Youwen Wu 2024-03-01 12:17:02 -08:00
parent 05c52d4d4a
commit 162de7c980

View file

@ -85,6 +85,20 @@
}
}
let gridFadeDistance = 30
const fadeGridIn = (delta: number) => {
if (gridFadeDistance < 100) {
gridFadeDistance += delta * 40
}
}
const fadeGridOut = (delta: number) => {
if (gridFadeDistance > 30) {
gridFadeDistance -= delta * 40
}
}
useTask(delta => {
/* TODO: standardize a scale (meters : grid lengths) so we can have
accurate positioning of sensor detected objects */
@ -95,6 +109,12 @@
$telemetryReadonlyStore['chassis-x-speed'] * delta * SPEED_MULTIPLIER
$mesh.rotation.y = $telemetryReadonlyStore.orientation * DEG2RAD
if ($cameraState.mode === 'orbit') {
fadeGridOut(delta)
} else {
fadeGridIn(delta)
}
// run the follow function
follow(delta)
})
@ -126,7 +146,7 @@
<Grid
sectionColor={'#ff3e00'}
sectionThickness={1}
fadeDistance={100}
bind:fadeDistance={gridFadeDistance}
cellSize={6}
sectionSize={24}
cellColor={'#cccccc'}