SetAnimTime Confusion

Blitz3D Forums/Blitz3D Programming/SetAnimTime Confusion

Gabriel(Posted 2005) [#1]
I've been banging my head against the wall looking for bugs in my code for a week now because my manual animation system kept glitching. Now I've found it, and I'm still confused.

It appears that this

SetAnimTime Entity,AnimLength(Seq),Seq


Sets the animation to a frame which does not exist within the animation sequence specified.

As long as I stop the time variable from ever reaching AnimLength(Seq) it appears not to happen. I kinda have to guess how much lower to keep it in order not to have any problems, which is a bit awkward, but it seems ok at this early stage.

Is this correct behaviour though? Why?


Sunteam Software(Posted 2005) [#2]
It wouldn't happen to be one of those things where the frames start from 0 to AnimLength(Seq)-1?


Gabriel(Posted 2005) [#3]
No, I don't think it's that. That was the first thing I thought of when I noticed it happening. But it only happens if the parameter supplied to SetAnimTime is exactly the same as the length. EG: If the length is 7 then 7.0 will cause it to display the incorrect frame but 6.98 ( for example ) won't.


Gabriel(Posted 2005) [#4]
And I've had confirmation on IRC that this has cropped up before. It seems that Blitz somehow manages to get the reference frame tangled up with the animations when you use AnimTime. It's patchy, in that I can't make it happen 100% of the time ( yet, I'm working on it ) but it happens plenty enough to ruin a game. Bug?


Barliesque(Posted 2005) [#5]
I've found that it doesn't matter how you set the animation time...
If, for example, I have a model with 100 frames, and I try to set the animation time to 638, it will wrap around and arrive at frame 38.
However... this is what I've found *without* using the sequence number parameter.


Gabriel(Posted 2005) [#6]
Well, without a sequence parameter, you're going to find that the reference frame is right at the beginning of your animation and you wouldn't be able to tell if it was there for the right reasons or the wrong reasons, so I'm inclined to agree that it won't show up if you only have the one sequence.

However, with a sequence extracted from the middle or end of the original animation, the reference frame shouldn't be there at all. Yet it is.


Gabriel(Posted 2005) [#7]
Small update:

I have tested playing back an animation very slowly and recording the time retrieved with AnimTime#() and I can confirm that when Blitz plays an animation all the way through, that includes the value returned by length, so it should *NOT* be necessary to keep the SetAnimTime() time parameter below the length of the animation.

I intend to investigate further, but it's hard to make it happen consistently so if anyone has come across this and knows how to make it go wrong consistently, that would be very helpful in tracking down the problem.