【问题标题】:TypeError: Cannot read property 'rotation' of undefined - three.jsTypeError:无法读取未定义的属性“旋转”-three.js
【发布时间】:2019-05-22 23:26:13
【问题描述】:

我试图让牛顿摇篮和移动球。我得到错误。这是整个代码https://notepad.pw/s1lozjcy 我知道角度无关紧要。

var tiltDirection = 1;
function render() {
    ball5.animated.rotation.x += tiltDirection * 0.5 * Math.PI/180;
    if(ball5.animated.rotation.x > 103 * Math.PI/180){
        tiltDirection = -1;
    ball5.animated.rotation.x = 2*(103 * Math.PI/180) - ball5.animated.rotation.x;
    }else if(ball5.animated.rotation.x < -22 * Math.PI/180){
        tiltDirection = 1;
    ball5.animated.rotation.x = 2* (-22 * Math.PI/180) - ball5.animated.rotation.x;
        }
        renderer.render(scene, camera);
    }

【问题讨论】:

    标签: three.js


    【解决方案1】:

    ball5.animated.rotation 应该是 ball5.rotation 吗?

    【讨论】:

    • 好的,现在我得到“由于目标被视为被动,无法在被动事件侦听器中阻止默认设置。”我不能用鼠标在窗口中移动。
    • 开始一个新问题或谷歌它:)
    猜你喜欢
    • 1970-01-01
    • 2017-01-07
    • 2013-06-16
    • 2015-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-29
    • 1970-01-01
    相关资源
    最近更新 更多