feat: change grid view distance
This commit is contained in:
parent
05c52d4d4a
commit
162de7c980
1 changed files with 21 additions and 1 deletions
|
@ -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 => {
|
useTask(delta => {
|
||||||
/* TODO: standardize a scale (meters : grid lengths) so we can have
|
/* TODO: standardize a scale (meters : grid lengths) so we can have
|
||||||
accurate positioning of sensor detected objects */
|
accurate positioning of sensor detected objects */
|
||||||
|
@ -95,6 +109,12 @@
|
||||||
$telemetryReadonlyStore['chassis-x-speed'] * delta * SPEED_MULTIPLIER
|
$telemetryReadonlyStore['chassis-x-speed'] * delta * SPEED_MULTIPLIER
|
||||||
$mesh.rotation.y = $telemetryReadonlyStore.orientation * DEG2RAD
|
$mesh.rotation.y = $telemetryReadonlyStore.orientation * DEG2RAD
|
||||||
|
|
||||||
|
if ($cameraState.mode === 'orbit') {
|
||||||
|
fadeGridOut(delta)
|
||||||
|
} else {
|
||||||
|
fadeGridIn(delta)
|
||||||
|
}
|
||||||
|
|
||||||
// run the follow function
|
// run the follow function
|
||||||
follow(delta)
|
follow(delta)
|
||||||
})
|
})
|
||||||
|
@ -126,7 +146,7 @@
|
||||||
<Grid
|
<Grid
|
||||||
sectionColor={'#ff3e00'}
|
sectionColor={'#ff3e00'}
|
||||||
sectionThickness={1}
|
sectionThickness={1}
|
||||||
fadeDistance={100}
|
bind:fadeDistance={gridFadeDistance}
|
||||||
cellSize={6}
|
cellSize={6}
|
||||||
sectionSize={24}
|
sectionSize={24}
|
||||||
cellColor={'#cccccc'}
|
cellColor={'#cccccc'}
|
||||||
|
|
Loading…
Reference in a new issue