need help with newbie programming problem

hello everybody, i have this problem that i need help with

i want to correct the camera distance with one factor that goes from 1 to 0 in such a way that if factor is 1 nothing is changed and when it is near 0 (it cant be zero, but the minimum value is 0.05) distance of the camera should be cut in half…

i cant get it to work…thanks!

Not quite sure what you’re asking, but sounds like the “Lerp” function might be what you’re looking for. It allows you to use values between 0 and 1 to move objects, change colors, lots of different things. Check it out in the scripting reference and see if it makes sense to you. If not, perhaps post a more detailed description of the problem and maybe we can help.

i know how to move camera, i just need correction of the calculated distance. i have this factor than need to affect the camera distance
if it is 1 then there is no affect and if it is zero or 0.05 then distance should be cut in half. all other values between 1 and 0.05 should affect
camera distance too…

so 1 = 0 % and 0 is 50%, this means 0.5 would be 25%, 0.75 would be 12.5% etc

so if we go (1 - factor)/2 you will get the number by which you need to multiply the camera distance by.

note if factor = 1 you actually end up with 0, so you would use an if statement to avoid that multiplying your camera distance by 0 as it will give undesirable results.