未捕获的类型错误:不能重新定义属性:旋转

Uncaught TypeError: Cannot redefine property: rotation

本文关键字:定义 旋转 属性 新定义 不能 类型 错误      更新时间:2023-09-26

我刚刚在另一台笔记本电脑上查看了一个正在运行的项目。在使用npm和bower安装所有内容后,当我试图在本地主机上运行它时,我得到以下错误:

Uncaught TypeError: Cannot redefine property: rotation 

at (non - minified three.js r67中的第7542行):

THREE.Object3D = function () {
this.id = THREE.Object3DIdCount ++;
this.uuid = THREE.Math.generateUUID();
this.name = '';
this.parent = undefined;
this.children = [];
this.up = new THREE.Vector3( 0, 1, 0 );
this.position = new THREE.Vector3();
var scope = this;
Object.defineProperties( this, {
    rotation: {
        enumerable: true,
        value: new THREE.Euler().onChange( function () {
            scope.quaternion.setFromEuler( scope.rotation, false );
        } )
    }, [...]

所以它的东西在three.js出错,我不知道为什么,但它显然打破了整个应用程序。有人经历过这个吗?

这是故意的

这些模式不再工作了:

object.rotation = object2.rotation
object.rotation = new THREE.Euler( 1, 0, 0 );

这样做:

object.rotation.copy( object2.rotation );
object.rotation.set( 1, 0, 0 );

下一个版本将会有更好的错误信息。