I was wondering if it is possible for python to get the frame an animation is currently on while the BGE is in-game. I’m trying to make a cutscene by using the current frame of my character’s animation to activate/deactivate Scene-Set Camera Actuators to switch cameras back and forth (frame 1-20 is camera 1, frame 21-40 is camera 2, etc.). Any ideas on how I’d go about getting the current frame?
*** Moderation ***
moved from Python Support
as it belongs to the BGE
*** End of Moderation ***
You can setup a frameProperty at the ActionActuator. The actuator will write the current frame into this property while playing.
As alternative you can use the ActuatorSensor to sense when the ActionActuator finished playing.
Another alternative is, to have a separate counter for switching cameras.
I think what you’re looking for is the getActionFrame method.
Thank you, both suggestions will work nicely.
As a warning, frames aren’t integers so if you check the results of getActionFrame against an integer, it will fail. I use the round function to get by this.
if round(arm.getActionFrame(0)) == 61: Do something