4
0
Fork 0
mini-shater/components/model/bench-table.vue

30 lines
695 B
Vue

<script setup lang="ts">
//@ts-ignore
import { useGLTF } from '@tresjs/cientos'
import { useTresContext } from '@tresjs/core'
import { degToRad } from 'three/src/math/MathUtils.js'
const { camera, controls } = useTresContext()
const { scene } = await useGLTF('/models/table.glb')
const object = calculateScaleToFit(
scene,
camera,
controls,
3,
{
x: Math.sin(degToRad(-30)), // Смещение по оси X
y: 1, // Нет смещения по оси Y
z: -Math.cos(degToRad(0)) // Смещение по оси Z
}
)
</script>
<template>
<Suspense>
<TresGroup>
<ModelItem :model="object" :target="[0, 0, 0]" />
</TresGroup>
</Suspense>
</template>