Appearance
tracking-controls
使相机平滑跟随移动的 Object3D 目标。
typescript
import { TrackingControls } from 'u-space/plugins/tracking-controls';
const tracking = new TrackingControls(viewer);
tracking.target = myMovingObject;
tracking.type = 'box3'; // 'position'(世界原点)或 'box3'(包围盒中心)
tracking.offset.set(0, 5, 0); // 相机目标偏移量
tracking.enable();
// tracking.disable();属性:
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
target | Object3D | null | null | 要跟踪的对象。 |
type | 'position' | 'box3' | 'position' | 跟踪世界位置还是包围盒中心。 |
offset | Vector3 | (0,0,0) | 在移动相机前叠加到跟踪位置上的偏移量。 |