TypeError: THREE.Math.lerp is not a function

Helloanon

I was searching for online references for WEBGL Three.js Games . Came across a game and its source code works fine for the one who gave it but i am getting an error

TypeError: THREE.Math.lerp is not a function

the snippet where this function is used is :

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
}
Mugen87

Math has been renamed to MathUtils with r113. So try it with the following code:

heroSphere.position.x=THREE.MathUtils.lerp(heroSphere.position.x,currentLane, 2*clock.getDelta());//clock.getElapsedTime());

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related