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
}
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());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With