I'm trying to get my head around render tweening, because I like the results and I'd like to implement it in my non-B3D game.
As far as I can see, the idea is something like this :
1) Get the amount of time which passed during the previous frame.
2) Using a fixed delta update your entities/physics once for every full time the fixed delta goes into the frame time. Store the remaining time in an "accumulator".
3) Generate a decimal fraction ( 0.0-1.0 ) by dividing the value in the accumulator by your fixed delta. Use this value to tween your entities.
I think that's right, anyway.
But then I get horribly confused when it comes to the actual tweening. When you tween you end up with the objects in a state other than the one you just put them in, don't you?
So my first instinct is to say that this means that you have to go back and "internally" put them back where they would have been had you not tweened as soon as rendering is done.
For example :
Let's say I have a cube which is currently at 0,0,0. If I say PositionEntity(Cube,0,0,100) but when it comes to tweening, the tween value is 0.66, I will end up with that entity at (0,0,66)
However, if I want to retrieve the Z coord with EntityZ#() at the beginning of the next frame, I'm going to expect it to be 100, aren't I? So insinctively, I'm thinking I should set it back to 100 after rendering. But that can't be right either, can it? Because if the tween value next frame is 0.5 then it's going in the wrong direction, isn't it?
Immediately after you render, you have to capture the state of the world again so you have something to tween against. Here again, I'm getting all twisted trying to figure out what the values I capture should be.
I think I'm missing something fundamental about this, and I'd appreciate it if someone could set me straight. There's very little information available on render tweening. I've googled extensively but I haven't been able to find much of anyone doing things the way Blitz3D does them. Or can do them if you choose to use CaptureWorld and all that.
As far as I can see, the idea is something like this :
1) Get the amount of time which passed during the previous frame.
2) Using a fixed delta update your entities/physics once for every full time the fixed delta goes into the frame time. Store the remaining time in an "accumulator".
3) Generate a decimal fraction ( 0.0-1.0 ) by dividing the value in the accumulator by your fixed delta. Use this value to tween your entities.
I think that's right, anyway.
But then I get horribly confused when it comes to the actual tweening. When you tween you end up with the objects in a state other than the one you just put them in, don't you?
So my first instinct is to say that this means that you have to go back and "internally" put them back where they would have been had you not tweened as soon as rendering is done.
For example :
Let's say I have a cube which is currently at 0,0,0. If I say PositionEntity(Cube,0,0,100) but when it comes to tweening, the tween value is 0.66, I will end up with that entity at (0,0,66)
However, if I want to retrieve the Z coord with EntityZ#() at the beginning of the next frame, I'm going to expect it to be 100, aren't I? So insinctively, I'm thinking I should set it back to 100 after rendering. But that can't be right either, can it? Because if the tween value next frame is 0.5 then it's going in the wrong direction, isn't it?
Immediately after you render, you have to capture the state of the world again so you have something to tween against. Here again, I'm getting all twisted trying to figure out what the values I capture should be.
I think I'm missing something fundamental about this, and I'd appreciate it if someone could set me straight. There's very little information available on render tweening. I've googled extensively but I haven't been able to find much of anyone doing things the way Blitz3D does them. Or can do them if you choose to use CaptureWorld and all that.