1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

ready event added to object3d

This commit is contained in:
Sander Moolin 2021-03-19 23:56:21 -04:00
parent 27969ea3bc
commit 5134ff91e6

View File

@ -4,6 +4,7 @@ import { bindProp } from '../tools.js';
export default { export default {
name: 'Object3D', name: 'Object3D',
inject: ['three', 'scene', 'rendererComponent'], inject: ['three', 'scene', 'rendererComponent'],
emits: ['ready'],
props: { props: {
position: { type: Object, default: { x: 0, y: 0, z: 0 } }, position: { type: Object, default: { x: 0, y: 0, z: 0 } },
rotation: { type: Object, default: { x: 0, y: 0, z: 0 } }, rotation: { type: Object, default: { x: 0, y: 0, z: 0 } },
@ -37,6 +38,8 @@ export default {
parent = parent.$parent; parent = parent.$parent;
} }
if (!this._parent) console.error('Missing parent (Scene, Group...)'); if (!this._parent) console.error('Missing parent (Scene, Group...)');
this.$emit('ready', this);
}, },
add(o) { this.o3d.add(o); }, add(o) { this.o3d.add(o); },
remove(o) { this.o3d.remove(o); }, remove(o) { this.o3d.remove(o); },