mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
add lookAt
This commit is contained in:
parent
123766305e
commit
9b85bc6cdd
@ -1,3 +1,4 @@
|
||||
import { watch } from 'vue';
|
||||
import { bindProp } from '../tools.js';
|
||||
|
||||
export default {
|
||||
@ -6,6 +7,7 @@ export default {
|
||||
position: Object,
|
||||
rotation: Object,
|
||||
scale: Object,
|
||||
lookAt: { type: Object, default: null },
|
||||
},
|
||||
// can't use setup because it will not be used in sub components
|
||||
// setup() {},
|
||||
@ -21,6 +23,9 @@ export default {
|
||||
bindProp(this, 'rotation', this.o3d.rotation);
|
||||
bindProp(this, 'scale', this.o3d.scale);
|
||||
|
||||
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 });
|
||||
|
||||
if (this.$parent.add) this.$parent.add(this.o3d);
|
||||
},
|
||||
add(o) { this.o3d.add(o); },
|
||||
|
Loading…
Reference in New Issue
Block a user