mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
Create troisjs object/group in separate component
This commit is contained in:
parent
9884606a9a
commit
5bc13469f1
@ -27,7 +27,15 @@ export default {
|
|||||||
if (this.lookAt) this.o3d.lookAt(this.lookAt.x, this.lookAt.y, this.lookAt.z);
|
if (this.lookAt) this.o3d.lookAt(this.lookAt.x, this.lookAt.y, this.lookAt.z);
|
||||||
watch(() => this.lookAt, (v) => { this.o3d.lookAt(v.x, v.y, v.z); }, { deep: true });
|
watch(() => this.lookAt, (v) => { this.o3d.lookAt(v.x, v.y, v.z); }, { deep: true });
|
||||||
|
|
||||||
if (this.$parent.add) this.$parent.add(this.o3d);
|
// traverse parents until we find something we can add to
|
||||||
|
let parent = this.$parent;
|
||||||
|
while (parent) {
|
||||||
|
if (parent.add) {
|
||||||
|
parent.add(this.o3d);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
parent = parent.$parent;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
add(o) { this.o3d.add(o); },
|
add(o) { this.o3d.add(o); },
|
||||||
remove(o) { this.o3d.remove(o); },
|
remove(o) { this.o3d.remove(o); },
|
||||||
|
Loading…
Reference in New Issue
Block a user