king2088 / vue-3d-loader

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

gltf glb 无法添加事件 ply 可以 #85

Closed FangAk closed 9 months ago

FangAk commented 9 months ago

const onMouseMove = (event: MouseEvent, intersected: any) => {
  let timer: number | null = null;
  if (object.value) {
    (object.value as any).material.color.setStyle("#fff");
    if (timer) {
      clearInterval(timer);
      timer = null;
    }
    (object.value as any).rotation.y = 0;
  }
  if (intersected) {
    object.value = intersected.object;
    (object.value as `any).material.color.setStyle("red");`
    (object.value as any).name = "test";
  } else {
    object.value = null;
  }
};
FangAk commented 9 months ago

intersected 为 null

king2088 commented 9 months ago

intersected 为 null

请查看API文档关于intersectRecursive的描述,并将其设置为truehttps://king2088.github.io/vue-3d-loader-docs/zh/guide/api.html#intersectrecursive

FangAk commented 9 months ago

ok 以解决 感谢