dev #84
|
@ -3,14 +3,7 @@ import { TresCanvas } from '@tresjs/core'
|
||||||
import { Stats, OrbitControls } from '@tresjs/cientos'
|
import { Stats, OrbitControls } from '@tresjs/cientos'
|
||||||
import { degToRad } from 'three/src/math/MathUtils.js';
|
import { degToRad } from 'three/src/math/MathUtils.js';
|
||||||
|
|
||||||
const section_count = use_section_count()
|
|
||||||
const fence_section = use_fence_section()
|
|
||||||
|
|
||||||
const defDistance = 3
|
|
||||||
const controlsState = reactive({
|
const controlsState = reactive({
|
||||||
distance: section_count.value,
|
|
||||||
minDistance: defDistance,
|
|
||||||
maxDistance: defDistance,
|
|
||||||
position: { x: 0, y: 0, z: 0 },
|
position: { x: 0, y: 0, z: 0 },
|
||||||
enablePan: false,
|
enablePan: false,
|
||||||
enableZoom: false,
|
enableZoom: false,
|
||||||
|
@ -22,16 +15,6 @@ const cameraStat = reactive({
|
||||||
aspect: 1920 / 600,
|
aspect: 1920 / 600,
|
||||||
// fov: 40,
|
// fov: 40,
|
||||||
})
|
})
|
||||||
|
|
||||||
const camera = ref("camera")
|
|
||||||
|
|
||||||
watch(fence_section, () => {
|
|
||||||
let v = fence_section.value * 2;
|
|
||||||
if (v <= defDistance) v = defDistance
|
|
||||||
controlsState.minDistance = v;
|
|
||||||
controlsState.maxDistance = v;
|
|
||||||
(camera.value as any).position.normalize().multiplyScalar(v)
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<ClientOnly fallback-tag="div">
|
<ClientOnly fallback-tag="div">
|
||||||
|
|
|
@ -63,13 +63,15 @@ watch(() => [section_count.value, extra_section.value], () => {
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
const setTarget = () => {
|
const setTarget = () => {
|
||||||
const f = fence_section.value * 0.5
|
let f = fence_section.value * lamelles_count.value * lamelle_height.value * 0.75
|
||||||
|
if (f < 3) f = 3
|
||||||
|
console.log(f)
|
||||||
const target = new Vector3(0, lamelles_count.value * lamelle_height.value * 0.5, 0);
|
const target = new Vector3(0, lamelles_count.value * lamelle_height.value * 0.5, 0);
|
||||||
(controls.value as OrbitControlsProps).target = target
|
(controls.value as OrbitControlsProps).target = target
|
||||||
camera.value?.position.set(f, f, f)
|
camera.value?.position.set(f, f, f)
|
||||||
}
|
}
|
||||||
setTarget()
|
setTarget()
|
||||||
watch(lamelles_count, setTarget)
|
watch([lamelles_count, fence_section], setTarget)
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
Loading…
Reference in New Issue