king2088 / vue-3d-loader

VueJS and threeJS 3d viewer plugin
https://king2088.github.io/vue-3d-loader-docs
MIT License
223 stars 38 forks source link

access to 3d object Meshes #46

Closed masoudabdan closed 1 year ago

masoudabdan commented 1 year ago

Hi. I need to list or access to meshes in a loaded 3d file. to change color or hide some meshes. how can i do this?

king2088 commented 1 year ago

You can use events get 3d object data, and you can change the color. Change 3d model color example. If you want hide/show some meshes or model, may be can use events same. Use it look like

<template>
  <vue3dLoader
    filePath="/models/ply/Lucy100k.ply"
    @mousemove="onMouseMove"
    :cameraPosition="{ x: 0, y: 0, z: -2500 }"
  />
</template>
<script setup lang="ts">
import { vue3dLoader } from "vue-3d-loader";
import { ref } from "vue";
const object = ref(null);
function onMouseMove(event: MouseEvent, intersected: any) {
  if (intersected) {
    object.value = intersected.object;
    (object.value as any).object.visible=false // hide model
    (object.value as any).material.visible=false; // hide material
  }
}
</script>
king2088 commented 1 year ago

No response after 7 days, closed