remove object

This commit is contained in:
Kseninia Mikhaylova 2024-06-12 13:33:00 +03:00
parent 858a5c8bc0
commit 58f4231907
2 changed files with 12 additions and 4 deletions

View File

@ -13,7 +13,7 @@ const pillar_size = 80 * 0.001
const pillar_one_pos = ref(fence_section.value * -0.5 - 0.01) const pillar_one_pos = ref(fence_section.value * -0.5 - 0.01)
const pillar_two_pos = ref(fence_section.value * 0.5 + pillar_size + bSize - 0.01) const pillar_two_pos = ref(fence_section.value * 0.5 + pillar_size + bSize - 0.01)
watch(fence_section, () => { watch([fence_section, lamelles_count], () => {
pillar_one_pos.value = fence_section.value * -0.5 - 0.01 pillar_one_pos.value = fence_section.value * -0.5 - 0.01
pillar_two_pos.value = fence_section.value * 0.5 + pillar_size + bSize - 0.01 pillar_two_pos.value = fence_section.value * 0.5 + pillar_size + bSize - 0.01
}) })

View File

@ -36,11 +36,19 @@ const { scene: top } = await useGLTF('/models_one/verh_100.glb')
const { scene: fence } = await useGLTF('/models_one/fence.glb') const { scene: fence } = await useGLTF('/models_one/fence.glb')
const { scene: fastening } = await useGLTF('/models_one/krepleniye_planok (1).glb') const { scene: fastening } = await useGLTF('/models_one/krepleniye_planok (1).glb')
const { scene: lamelle } = await useGLTF('/models_one/lamel_100.glb') const { scene: lamelle } = await useGLTF('/models_one/lamel_100.glb')
const { seekAll } = useSeek()
const { seek, seekAll } = useSeek()
watch(section_count, () => { watch(section_count, () => {
const fences = seekAll(scene.value, 'name', 'fence') const fences = seekAll(scene.value, 'name', 'fence')
if (fences.length > (section_count.value as number)) { const base = seek(scene.value, 'name', 'base')
fences[fences.length - 1].remove() const n = (section_count.value as number)
if (fences.length > n) {
for (let i = fences.length; i > n; i--) {
const item = fences[i - 1]
if (item) {
base?.remove(item)
}
}
// renderer.value.render(scene.value, camera.value) // renderer.value.render(scene.value, camera.value)
} }
}) })