Graphics TypeError:THREE.Math.lerp不是一个函数
我在网上搜索WEBGL Three.js游戏的参考资料。 遇到了一个游戏,它的源代码对提供它的人来说很好,但是我得到了一个错误 TypeError:THREE.Math.lerp不是一个函数 使用此函数的代码段是:Graphics TypeError:THREE.Math.lerp不是一个函数,graphics,three.js,Graphics,Three.js,我在网上搜索WEBGL Three.js游戏的参考资料。 遇到了一个游戏,它的源代码对提供它的人来说很好,但是我得到了一个错误 TypeError:THREE.Math.lerp不是一个函数 使用此函数的代码段是: function update(){ //stats.update(); //animate rollingGroundSphere.rotation.x += rollingSpeed; heroSphere.rotation.x -= heroRo
function update(){
//stats.update();
//animate
rollingGroundSphere.rotation.x += rollingSpeed;
heroSphere.rotation.x -= heroRollingSpeed;
if(heroSphere.position.y<=heroBaseY){
jumping=false;
bounceValue=(Math.random()*0.04)+0.005;
}
heroSphere.position.y+=bounceValue;
heroSphere.position.x=THREE.Math.lerp(heroSphere.position.x,currentLane, 2*clock.getDelta());//clock.getElapsedTime());
bounceValue-=gravity;
if(clock.getElapsedTime()>treeReleaseInterval){
clock.start();
addPathTree();
if(!hasCollided){
score+=2*treeReleaseInterval;
scoreText.innerHTML=score.toString();
}
}
doTreeLogic();
doExplosionLogic();
render();
requestAnimationFrame(update);//request next update
}
函数更新(){
//stats.update();
//生动活泼
rollingGroundSphere.rotation.x+=滚动速度;
heroSphere.rotation.x-=herorrollingspeed;
if(heroSphere.position.ytreeReleaseInterval){
clock.start();
addPathTree();
如果(!已碰撞){
分数+=2*T间隔;
scoreText.innerHTML=score.toString();
}
}
dotrelogic();
doExplosionLogic();
render();
requestAnimationFrame(更新);//请求下一次更新
}
Math
已使用r113
重命名为MathUtils
。因此,请使用以下代码进行尝试:
heroSphere.position.x=THREE.MathUtils.lerp(heroSphere.position.x,currentLane,2*clock.getDelta())//clock.getElapsedTime());