Hi,
I am creating some sort of interactive slideshow.
So here is what I want to do:
I want to increase a value, for example a distance, to a specific value, in a given fixed(!) time.
So far my function works fine. But I need too add a third component with wich I have a lot of problems. I want to smooth the movement in and out. I have no problem to do that with a not fixed timeframe, but I need a fixed one.
My problem is, that I don't now how much time is gone on a specific position, because I use time_step to be framerate independent.
what I have (works fine):
var camDistance; // filled in another function
void MoveToOrbit(var distance, var time)
{
var t = 0;
while(t < time)
{
t += 16 * time_step;
var factor = t / time; // actual position in timeframe
var distDif = abs(camDistance - distance); //get distance
var nDist = camDistance;
if(distance < camDistance)
{
nDist -= distDif * factor;
}
else
{
nDist += distDif * factor;
}
//(...) here the nDist var is put to use, for cameraDistance
wait(1);
}
// (...) here the camDistance value and the actual camera value is set to distance-functionparameter to correct small discrepancies
}
What I want:
void MoveToOrbit(var distance, var time, var smoothTime)
I hope someone can help me with that.
Greetings,
Patrick