本文整理汇总了TypeScript中THREE.Object3D.lookAt方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Object3D.lookAt方法的具体用法?TypeScript Object3D.lookAt怎么用?TypeScript Object3D.lookAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类THREE.Object3D
的用法示例。
在下文中一共展示了Object3D.lookAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: if
], (instance: Object3D,
{rotation, quaternion, lookAt}: {
rotation?: Euler,
quaternion?: Quaternion,
lookAt?: Vector3,
}) => {
if (lookAt != null) {
if (isNonProduction) {
if (quaternion != null) {
console.warn("An object is being updated with both 'lookAt' and 'quaternion' properties.\n" +
"Only 'lookAt' will be applied.");
} else if (rotation != null) {
console.warn("An object is being updated with both 'lookAt' and 'rotation' properties.\n" +
"Only 'lookAt' will be applied.");
}
}
instance.lookAt(lookAt);
} else if ((quaternion != null)) {
instance.quaternion.copy(quaternion);
} else if ((rotation != null)) {
instance.rotation.copy(rotation);
} else {
// looks like everything is unset
instance.quaternion.set(0, 0, 0, 0);
}
}).withTypes({
示例2:
this.hasProp("position", (instance: Object3D,
newValue: Vector3 | null,
oldProps: IObject3DProps,
newProps: IObject3DProps): void => {
if (newValue === null) {
instance.position.set(0, 0, 0);
} else {
instance.position.copy(newValue);
}
if ((newProps.lookAt != null)) {
instance.lookAt(newProps.lookAt);
}
}).withType(PropTypes.instanceOf(Vector3));