Jump to content

Pause/Resume Animation


StOneDOes
 Share

Recommended Posts

Can we please have a way to pause the current animation, and then resume it?
Use case: Player is climbing a ladder and then stops. Animation needs to stop on the given frame, and then be resumed when the player starts moving again.

I don't think this can be done with the existing functions; you can choose which frame to start from, but I don't think you would know which frame you have stopped at.

  • Like 1
  • Upvote 1
Link to comment
Share on other sites

In this situation, if you finish climbing the ladder, would it matter where you start the next animation from? Wouldn't any starting point work, since it would just transition from the ladder animation to the walking animation (or maybe a "get to the top" animation played in between the two.

I kind of started moving the animation frame data back to the main thread to make that available. I'm not sure how it will work yet, but it would be convenient for things like timng footsteps.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Apologies if the use case was unclear; First person view game, you are climbing a ladder, so you have an animation of your hands climbing upward. Now you stop climbing, midway on the ladder. I expect that I can make my hand animation pause where it was (otherwise my hands would keep moving). Then I decide to continue climbing, so I would like the animation to continue from where it was. 

Hope that is more clear.

EDIT: Just in case you did understand me, but are just seeking further clarification;

Quote

In this situation, if you finish climbing the ladder, would it matter where you start the next animation from? Wouldn't any starting point work, since it would just transition from the ladder animation to the walking animation (or maybe a "get to the top" animation played in between the two.

I don't think it would necessarily matter, but I'm not sure of the implication. When I'm finished climbing I would just transition back to either hands-idle, or if you had a weapon out it would be like hands-holster, then weapon-unholster, and then weapon-idle.

 

I probably could achieve this whole thing with a bit of guesswork but it wouldn't be an exact science. I would need to track the milliseconds passed since animation started so that I could calculate which frame I should be up to.

Link to comment
Share on other sites

Internally, the animation state looks something like this:

	struct QueuedAnimation
	{
		int sequence;
		int length;
		float duration;
		float speed;
		int mode;
		int frameoffset;
		float currentframe;
	};

Each animation node (analog to a bone, that lives only in the animation threads) stores an STL vector of these to track the animation state.

I am thinking about feeding this data back to the main thread, to let the user read.

It's not quite as simple as "get the current frame of the animation" because at any given time there could be 20 different animations in the stack. The most recently played animation is at the end, and older animations get removed once the later animations finish their blend transition in. But in most cases you could probably just get the last animation, consider it to be the current most important one, and get the current frame of that.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...