This commit is contained in:
Kseninia Mikhaylova 2024-09-04 10:44:11 +03:00
parent f2c916eb7e
commit 95a4d61b26
3 changed files with 8 additions and 24 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

View File

@ -59,9 +59,7 @@ const itemStore = useItem();
const { controls, camera, scene, raycaster, renderer } = useTresContext()
const { seekByName, seekAllByName } = useSeek()
const pointerTexture = await useTexture({
map: '/pointer_texture.png'
})
const { scene: point_mesh_obj } = await useGLTF((await import('../../assets/pointer/point-v1.glb')).default)
const set_moveto = (obj: smooth, value: Vector3 | Quaternion | undefined) => {
obj.value = value
@ -179,27 +177,11 @@ const loadModels = async () => {
(find_element as Mesh).localToWorld(world_position);
const p = raw_dataStore.data.min_distance * 0.05;
const name = index % 5
const fileTexture = await import(`../../assets/pointer/${name}.png`);
const pointerTexture = await useTexture({
map: fileTexture.default
})
const point_mesh = new Mesh(
new CircleGeometry(0.5, 32),
new MeshBasicMaterial({
color: new Color('#fff'),
map: pointerTexture.map,
transparent: true,
blending: AdditiveBlending
})
)
point_mesh.rotateX(-0.5 * Math.PI)
const point = new Group()
point.add(point_mesh)
const point = point_mesh_obj.clone()
point.position.set(world_position.x, p * 3, world_position.z * 2)
point.updateMatrixWorld()
point.name = `${element.id}_clickable`
if (clickable_items.value.find(el => el.name == point.name)) continue
@ -314,7 +296,9 @@ const { onAfterRender } = useLoop()
onAfterRender(() => {
clickable_refs.value.map(el => {
if (el.value[0] && el.value[0].children) {
el.value[0].children[0].lookAt(camera.value?.position)
el.value[0].children[0].lookAt(camera.value?.position);
el.value[0].children[0].rotateX(90 * (Math.PI / 180));
el.value[0].children[0].rotateZ(15 * (Math.PI / 180));
const dis_to_cam = camera.value?.position.distanceTo(el.value[0].position);
if (dis_to_cam) {