这次问题应该简单一点,就是我写了个ts文件用hooks封装了一下,然后在另一个ts文件中引入进来了第五行的相机camera,想要用tween实现相机的移动,但是这里出现个问题,打印的相机位置不断地移动了,但是three.js渲染的canvas画布上相机位置一点没动,
```typescript
import * as THREE from "three";
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
import * as TWEEN from "@tweenjs/tween.js";
import { useThree } from "./useThree";
const { scene, camera, renderer, schedule } = useThree();
interface CarModel {
cameraMove: TWEEN.Tween<THREE.Vector3>;
}
export default async function car(): Promise<CarModel> {
const loader = new GLTFLoader();
let cameraMove: any;
// let cameraMove=new TWEEN.Tween(camera.position).to({ x: 215, y: 1, z: 80 }, 20000);
try {
cameraMove=new TWEEN.Tween(camera.position).to( new THREE.Vector3(215, 1, 80), 13000).onUpdate(() => {
console.log('相机移动',camera.position);
camera.updateProjectionMatrix();
});
} catch (error) {
};
function animate() {
requestAnimationFrame(animate);
TWEEN.update();
renderer.render(scene, camera);
}
animate();
return {
cameraMove,
};
}
```