Added a mouse follow animation

This commit is contained in:
2022-01-29 17:01:19 +03:00
parent ce6fc1a0eb
commit 903bb60f20
2 changed files with 24 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
import { Group } from 'three';
import { Group, Vector3 } from 'three';
export default class MockupModel extends Group {
constructor() {
@@ -35,4 +35,12 @@ export default class MockupModel extends Group {
rotateAnim() {
this.rotation.y += 0.02;
}
lookAtAnim(x, y, camera) {
const target = new Vector3();
target.x = x;
target.y = y;
target.z = camera.position.z;
this.lookAt(target);
}
}