- Home /
Can I make animations snap to a frame?
When I import animations from Maya, I bake all the keys for all objects and save the file to Maya Binary format, but I get lots of problems when I play the animations, f.e if I do animation with replacing technique , like replacing the mouth in one frame when I play the animation in Unity the animation will play some inbetween frame that shows the mouth dislocated. I guess this is because Unity is playing the animation based on time and not on frame, but is there a way to make it Snap to a frame?
In Maya, the way to achieve this is to make all keys Stepped which means no interpolation between frames all transformation remain static until next keyframe is reached. but Unity (at least Unity iPhone) does not recognize this kind of interpolation.
Answer by runevision · Oct 27, 2009 at 05:18 AM
If you want to only sample an animation at times that are snapped to frames, you must manually set the time of the AnimationState of the relevant clip in the Update function. In order to snap to frame x, set the time to x / frameRate. You can get the framerate from the AnimationClip.
Answer by awesomedata · May 20, 2016 at 08:51 PM
@runevision Could you give some example code? Not sure I'm following, especially if I might want it to be on the same frame on every client in a multiplayer game...
Your answer
Follow this Question
Related Questions
Can Unity support Maya set driven keys? 1 Answer
Trying to understand what animation I can export exactly from maya and max to Unity 0 Answers
Multiple Animated Objects Maya 0 Answers
Why can't I edit animation curves imported from Maya? 1 Answer
How do I create animation clips in Maya and import to Unity? 3 Answers