UNPKG

mylingo3d

Version:

Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor

45 lines 1.69 kB
import { applyMixins } from "@lincode/utils"; import { foundDefaults, foundSchema } from "../../interface/IFound"; import TexturedBasicMixin from "./mixins/TexturedBasicMixin"; import TexturedStandardMixin from "./mixins/TexturedStandardMixin"; import { appendableRoot } from "../../api/core/Appendable"; import SimpleObjectManager from "./SimpleObjectManager"; import { standardMaterial } from "../utils/reusables"; class FoundManager extends SimpleObjectManager { static componentName = "find"; static defaults = foundDefaults; static schema = foundSchema; material; constructor(mesh) { super(mesh); //@ts-ignore this.material = mesh.material ??= standardMaterial; appendableRoot.delete(this); } model; retargetAnimations() { if (!this.model?.animationManagers) return; for (const animationManager of Object.values(this.model.animationManagers)) this.animations[animationManager.name] = this.watch(animationManager.retarget(this.nativeObject3d)); this.model = undefined; } get animation() { return super.animation; } set animation(val) { this.retargetAnimations(); super.animation = val; } managerSet; addToRaycastSet(set) { if (!this.managerSet) { this.managerSet = true; this.nativeObject3d.traverse((child) => (child.userData.manager = this)); } return super.addToRaycastSet(set); } } applyMixins(FoundManager, [TexturedBasicMixin, TexturedStandardMixin]); export default FoundManager; //# sourceMappingURL=FoundManager.js.map