The lerp-function worked for the targetdistance and targetheight.
spdChangeFOV set to 0.01
if (follow_this.fwd_mps > 150):
if (get_fov() < maxFOV):
set_fov(lerp(get_fov(), maxFOV, follow_this.fwd_mps * delta * spdChangeFOV))
target_distance = lerp(target_distance, 2.5, spdChangeFOV)
target_height = lerp(target_height, 0.5, spdChangeFOV)
else:
if (get_fov() > minFOV):
set_fov(lerp(get_fov(), minFOV, follow_this.fwd_mps * delta * spdChangeFOV))
target_distance = lerp(target_distance, 4.0, spdChangeFOV)
target_height = lerp(target_height, 1.0, spdChangeFOV)
This kinda works kinda works for the FOV, but can't get it dependent on the the speed.
With lerp(), I can probably leave out the "if (getfov() < maxFOV):" and the "if (getfov() > minFOV):" somehow, if I want to make it dependent on the speed of the car?
What I'm actually trying to achieve is to trigger this camera-change from a certain speed on, ie 150 km/h. Below this the camera FOV should stay the minFOV. Beyond that point, the camera FOV (together with the target distance and height) should gradually change, and the topspeed (ie 200 km/h) being the maxFOV.
And everything in between propotionally between those value. ie when speed is around 170 km/h, the FOV would be around 82, when the speed is around 185 km/h, the FOV could be around 91 or something.
Don't know if that is what the lerp function is for also?
What do you mean by not calling the lerp-function once?
Also, so the process function is at the same level as _physicsprocess? And I don't have to call it or anything? I can just put the code I have (at the top of this message) and paste it in that _process function?
Cheers and thanks for the help.