Jump to content

GetAnimationFrame is missing


tumira
 Share

Recommended Posts

EDIT - Weird, but Entity:GetAnimationFrame(#) is exposed to lua. I assume the reason its not documented is due to Josh's reason as the frame can be just an interpolated point between frames?

 

 

EDIT2 - Sorry Genebris - yes it will cause a crash. I had that in my original post but erased it all after I saw Josh's post.

  • Upvote 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

This actually returns a mat4 containing the orientation at that frame number and sequence. However, this should not be used. I think this was an experimental thing for something else...

  • Upvote 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

How do we make the entity continue playing the animation when it is loaded back or even save the animation frame? Example the crawler is playing attack animation at frameno 15 when it is saved. How do we get the frameNo for saving?

 

Other than the new PlayAnimation() command, are you not setting the frame value for the command SetAnimationFrame()? why could you not save that variable value?

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

 

 

Other than the new PlayAnimation() command, are you not setting the frame value for the command SetAnimationFrame()? why could you not save that variable value?

 

That frameNo15 is just example. In realtime how would you know which animation frameNo is playing ?

 

We can save the state "attacking" by saving the state value but we could not know at which frameno it is playing to save.

Link to comment
Share on other sites

Other than the new PlayAnimation() command, are you not setting the frame value for the command SetAnimationFrame()? why could you not save that variable value?

The frames can be blended together, so there isn't one single animation or frame playing.

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

You are setting that frame value for SetAnimationFrame() - so save it as member for that entity to be gathered at a later time. Yes, Josh I understand that the actual frame being set could be an interpolation but for the most part a person could get away with grabbing the integer value of the current frame value and no one would be the wiser.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

You are setting that frame value for SetAnimationFrame() - so save it as member for that entity to be gathered at a later time. Yes, Josh I understand that the actual frame being set could be an interpolation but for the most part a person could get away with grabbing the integer value of the current fame value and no one would be the wiser.

You can also have multiple instances of the same sequence that are being used at the same time. There isn't one definite value for the frame sequence.

 

Why are you asking for this?

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

I added a GetFrame() function to the old AnimationManager.lua (one was there but I tweaked it). However, that has a way to expose the current "frame". Not sure about the new way.

yeah doesn't appear to be a way to grab it from the new PlayAnimation(), but the older method or using the old Animation Manager script, you should be able to grab that value since the user is the one setting the frame value.

 

You can also have multiple instances of the same sequence that are being used at the same time. There isn't one definite value for the frame sequence.

 

Why are you asking for this?

I am not - just giving ideas on how to get this value. Are you talking about multiple instances of models playing the same sequence that may be at different points in their animation? If so, you would grab that value just like you would for anything else for that specific instance. The question arose because they are wanting to save the animation value along with other states when saving a game. I assume this person is also tracking entities so he can save their position, rotation, health, animation sequence name, etc... so i am having trouble understanding why the current frame (or at least a very close approximation) could not be saved as well.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

For our purposes, we are syncing the "frame" one a zombie struggle animation with fps arms struggle animation so they are playing the same "frame" so it looks right as the animations between the 2 were created to match. Tum is talking about saving that data, which I'm not sure why you'd ever want to do that.

Link to comment
Share on other sites

It doesn't look like it. For the sake of ease PlayAnimation() has it's limitations. If you want you can use the old AnimationManager.lua script and that has ways to get the frame that's being played. However, the question is why would you need this to save to disk? No game I've ever seen saves while something is in the middle of an animation and then when you load the game it starts right in the middle of that animation. That seems like an odd request.

Link to comment
Share on other sites

@rick. I think there is quite a lot of fps games is saving this syle. Example halflife1 and 2, farcry series, quake series. Not sure about farcry3 and 4. Doom1,2 i think even doom3. Doom 4 is actually using checkpoint style.

 

I guess leadwerk engine is suitable for checkpoint syle?

Link to comment
Share on other sites

There is no such thing as "the current animation frame", but there is such a thing as the current 4x4 matrix of each bone.

 

I don't understand why you would want to save any of that data though. Just set the blending value to 1.0 the first time the entity is animated, and the viewer will never see anything wrong.

 

I wouldn't even think about this until the game is near release. Even if blending is enabled, we're talking maybe a half-second delay the user will never notice.

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

I get the theory, I think: if you save right as a sword swing is about to take your head off, when you load the game, it should load back at that exact same point, not at the beginning where the player has time to avoid the swing. That said, I've never come across this issue in a game.

 

Curiosity question though: if there is an endhook, how is there not a current animation frame? How would the animation know when to end if it doesn't know where it currently is?

Link to comment
Share on other sites

The animation manager has a stack of currently playing animations, which do track a current frame, but the stack can be any size and consist of any animations, including multiple copies of the same animation sequence.

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

  • 1 year later...

I know this is an old subject but I wanted to pitch in my 2 cents.

 

I think we do need something like that but @Josh is correct. There's no such thing as Frames with 3D. There are just static bone positions that get blended between. If you have a hand animation move from left to right, It can take 60 proverbial "frames" (like in-game FPS Frames) to blend between one position and another or you could slow play the animation at 50% the speed and now it takes 120 in-game frames.

BUT Something like this would still indeed be useful for stuff like, when you need to sync some events with the key positions of an animation.

For example without using the term "Frame", Say you have a character running animation, the point when the foot touches the ground, you put a trigger which does 3 things. 

1) It plays the Foot Step Sound effect[

2) It spawns a small dust particle as if the foot is kicking up dust.

3) It spawns a small decal sprite on the floor to make a shoe footprints or Bloody foot print if you stepped in a pool of blood.

 

I would personally find it extremely useful for triggering sound effects.

 

So what if instead of Frames we treat it as a float value? Have 0.0 being the start of an animation and 1.0 being the end. In this sense we are not dealing with any predetermined time formats like frames and if you decide to stretch the animation (By playing it at half the speed in Leadwerks) then techincally all your stuff would still be synced. 

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...