Hello, it’s me again… I never had such a headache using LibGDX in the past few months, as I ran into another weird behavior
I want to use Interpolation between two vectors. The thing is, they dont work so far.
I use the following code to do the interpolation:
Initialization
realPos = new Vector2();
targetPos = new Vector2();
realPos.set(80.0f, 80.0f);
targetPos.set(280.0f, 80.0f);
interpolation = Interpolation.swing;
Update code
if (interpolation != null) {
realPos.interpolate(targetPos, 0.1f, interpolation);
Gdx.app.log("Position", realPos.x + "/" + realPos.y + " - " + targetPos.x + "/" + targetPos.y);
}
And this is what I get with logging… The first one is the real position vector, the second after the “-” mark is the target.
I basically goes to negative infinity…
Position: 71.200005/80.00001 - 280.0/80.0
Position: 62.01281/80.000015 - 280.0/80.0
Position: 52.42138/80.00002 - 280.0/80.0
Position: 42.40792/80.00003 - 280.0/80.0
Position: 31.953873/80.00004 - 280.0/80.0
Position: 21.039845/80.000046 - 280.0/80.0
Position: 9.645598/80.00005 - 280.0/80.0
Position: -2.2499952/80.00006 - 280.0/80.0
Position: -14.668996/80.00007 - 280.0/80.0
Position: -27.634434/80.00008 - 280.0/80.0
Position: -41.17035/80.000084 - 280.0/80.0
Position: -55.301846/80.00009 - 280.0/80.0
Position: -70.05513/80.0001 - 280.0/80.0
Position: -85.45756/80.00011 - 280.0/80.0
Position: -101.53769/80.000114 - 280.0/80.0
I must do something very stupid here ???