@Chakku What I mean is that I want the animation to reset when an event happens before the animation reaches the last frame. Is there some way to access the exact frame the animation is currently on, like self.animation.frame = 1 etc?
I would want the function to work like this: When attribute "foo" = "bar" set self.animation.frame to 1 Then continue the animation from there.
NO, that's not currently possible with creator. However, you can play around with the animations frames per second and keep track of time in the background, so you can check what frame the animation is on after a certain number of seconds, once that event happens. You must create many actors each with starting on a different frame of the animation. And then you can spawn the particular animation actor on top of the other one. This will give you the same effect
Note that you don't have to do it exactly the way I specified above.
If you destroy the actor and spawn a new one at the same time the animation will play from frame one.
Whoops ...meant to say that he also needed many actors each with a different starting frame, and he had to create a rule that specified which one should be spawned depending on the current frame.
Whoops ...meant to say that he also needed many actors each with a different starting frame, and he had to create a rule that specified which one should be spawned depending on the current frame.
All he has said is that he would like "the animation to reset when an event happens before the animation reaches the last frame" - he's not mentioned anything about needing actors with different starting frames ?
You can do this by destroying the current actor when this event / trigger happens and spawn a new one in its place, the new actor will start its animation from frame one.
He also wanted to know how to know what frame the animation is on; that's why I suggested he create an integer attribute that increases by one every x seconds (x= his animation's FPS).
. . . you can play around with the animations frames per second and keep track of time in the background, so you can check what frame the animation is on after a certain number of seconds . . .
This won't work as the animation frame rates are unstable and bear no relation to the claimed frame rates (for example 29, 28, 27, 26, 25, 24, 23, 22 and 21 frames per second in the animation behaviour all run at 20.1 fps).
Well say it's set at one frame per second. Then every second change integer attribute scene.animationframe to scene.animationframe+1. Then 16 seconds later he want to know what frame it's on, it'll be frame 16, as it's going at 16 FPS?
This is, of course, in theory, as I haven't tested it yet.
He also wanted to know how to know what frame the animation is on;
In the context of his question I suspect that when he said . . .
Is there some way to access the exact frame the animation is currently on, like self.animation.frame = 1 etc?
. . . he was asking how to access (as in 'goto') a particular frame, specifically frame 1.
(That was my interrelation at least).
that's why I suggested he create an integer attribute that increases by one every x seconds (x= his animation's FPS).
I'm not quite sure how this would help (maybe I don't quite understand what you are getting at) ?
For example if his animation was running at 24 fps he would create an attribute that increases by 1 every 24 seconds ? What would he do with this attribute, what use would it be to him ?
Well say it's set at one frame per second. Then every second change integer attribute scene.animationframe to scene.animationframe+1. Then 16 seconds later he want to know what frame it's on, it'll be frame 16, as it's going at 16 FPS?
Let's imagine this idea works (I suspect it doesn't) - how would he make use of it ?
I think a more clean way would be to have a boolean attribute like animatetrigger or something and then have a rule that said if animatetrigger=true then do the animation, and when you wanted to restart the animation you would turn animatetrigger off and then back on. Also, why would you want to reset the animation in the middle?
Comments
Check the loop checkbox!
And if you want it to loop only after a certain event, then make a rule When certainevent is true, change attribute animation to true
If animation is true, animate
Hope this helps
Chakku
I would want the function to work like this:
When attribute "foo" = "bar"
set self.animation.frame to 1
Then continue the animation from there.
NO, that's not currently possible with creator. However, you can play around with the animations frames per second and keep track of time in the background, so you can check what frame the animation is on after a certain number of seconds, once that event happens. You must create many actors each with starting on a different frame of the animation. And then you can spawn the particular animation actor on top of the other one. This will give you the same effect
Note that you don't have to do it exactly the way I specified above.
Hope this helps
Chakku
You can do this by destroying the current actor when this event / trigger happens and spawn a new one in its place, the new actor will start its animation from frame one.
He also wanted to know how to know what frame the animation is on; that's why I suggested he create an integer attribute that increases by one every x seconds (x= his animation's FPS).
Chakku
Well say it's set at one frame per second. Then every second change integer attribute scene.animationframe to scene.animationframe+1. Then 16 seconds later he want to know what frame it's on, it'll be frame 16, as it's going at 16 FPS?
This is, of course, in theory, as I haven't tested it yet.
Chakku
Is there some way to access the exact frame the animation is currently on, like self.animation.frame = 1 etc?
. . . he was asking how to access (as in 'goto') a particular frame, specifically frame 1.
(That was my interrelation at least). I'm not quite sure how this would help (maybe I don't quite understand what you are getting at) ?
For example if his animation was running at 24 fps he would create an attribute that increases by 1 every 24 seconds ? What would he do with this attribute, what use would it be to him ?
Confused.