This commit is contained in:
Kseninia Mikhaylova 2024-07-01 12:54:30 +03:00
parent c4fd5645a8
commit 281a229b58
2 changed files with 12 additions and 4 deletions

View File

@ -73,18 +73,24 @@ const loadModels = async () => {
const element = clickable.value[index];
const find_element = seekByName(scene.value, element.object_name)
if (!find_element) continue
const res_array = (find_element as Group).isGroup ? find_element?.children : [find_element]
// const res_array = (find_element as Group).isGroup ? find_element?.children : [find_element]
if (find_element && !(find_element as Group).isGroup) {
const world_position = new Vector3();
((find_element as Mesh).geometry.boundingBox as any).getCenter(world_position);
(find_element as Mesh).localToWorld(world_position);
const map = new TextureLoader().load('sprite.png');
const p = raw_data.min_distance * 0.05
const material = new MeshBasicMaterial({ color: new Color('red'), side: DoubleSide });
const plane = new PlaneGeometry(p, p)
const point = new Mesh(plane, material);
const mesh_material = new MeshBasicMaterial({side: DoubleSide})
if(element.image) {
const map = new TextureLoader().load(`${IMAGE_URL}/${element.image}`);
mesh_material.map = map
} else {
mesh_material.color = new Color('red')
}
const point = new Mesh(plane, mesh_material);
point.position.set(world_position.x, p * 3, world_position.z)
point.name = `${element.id}_clickable`
point.renderOrder = 1
@ -130,6 +136,7 @@ watch(() => props.source, () => {
if (loaded) {
loaded.children = []
}
sidebar.close()
loadModels()
})

View File

@ -38,6 +38,7 @@ interface clickableAreaType {
id: number;
name: string;
object_name: string;
image?: string;
source: number;
target: number;
target_name?: string