How could I replicate the opposite of this lerping function?

后端 未结 1 967
渐次进展
渐次进展 2021-01-29 11:36

In the lerping function below, it will slow down a camera which is following a moving object, and as the moving object slows down or stops the camera catches up to it. I need th

相关标签:
1条回答
  • 2021-01-29 11:53

    just increase to 110% instead of decreasing to 10%

    float lerp = 1.1f;
    position.x += (Obj.x + position.x) * lerp;
    position.y += (Obj.y + position.y) * lerp;
    

    Example:

    public static void main(final String[] args)
    {
        double position = 0;
        for (int i = 0; i < 100; i++)
        {
            position = (position + 10) * 1.1;
            System.out.println("position = " + position);
        }
    }
    
    0 讨论(0)
提交回复
热议问题