mocap on the knee (Skeletal Animations 2)

    On May 12, 2007, Jochen Diehl published a very interesting article , Skeletal Animations .



    I will briefly outline the essence:

    1. there is no skeletal animation in the article (in the very first sentence, the author stated: “This is no true bones animation”)
    2. data for a 10-frame animation is an array of points
    3. the points themselves, the author MANUALLY (hovering over the cursor and writing out the coordinates) collected from a person’s gait record. He used 10 frames equally distributed over time.
    4. in the process of playing a clip, the animation is smoothed using interpolation
    5. at the end of the article, the author suggests continuing his experiment:
      • use time based animation instead of frame with interpolation
      • record your own actions (jumping, running ...) and try to make smooth transitions between them
      • add shadows
      • add a skeleton and make a ragdoll dying like in life
      • unsubscribe to the forum


    What attracted me to the method:

    1. the ability to NOT go deeper into 3D modeling - let 3D modelers do it
    2. the opportunity NOT to delve into the issues of transferring 3D to flash - for me for small projects this is useless
    3. a very simple method to get various actions for characters

    * if it’s interesting, I will write down the methodology for adding new movements, characters on the hub in detail, paragraphs

    Next:

    First, I translated the animation into time based (there’s nothing complicated):

    public function update(time:Number):void
    {
    	render(currentFrame);
    	currentFrame+=(actionArray.length*time/actionLoopTime);
    	currentFrame = int(currentFrame*100)/100;
    	if(currentFrame>actionFrameNumber)
    	{
    		currentFrame-=actionFrameNumber;
    	}
    }
    


    But then, in the process of immersion in the method, I realized that there is at least one more attractive (for me) opportunity to diversify the crowd of NPC-characters on the screen. It is enough, after all, to just slightly deform the initial “skeleton” in key frames in the way we need, and get an infinite number of options for figures and characters.

    For example (the code can be seen in the source code of Main.handleGUIChange - I'll just show the essence here):
    • shorten legs and arms ( scale * point.y; scale * point.z; ) - get a gnome
    • extend arms and legs ( scale * point.y; scale * point.z; ) - get Uncle Styopa
    • tighten your waist and expand your hips ( scale * point.x; ) - get a masculine woman
    • narrow shoulders and broad waist ( scale * point.x; ) - get a effeminate man
    • tilt your body, bend your knees - ducking soldier
    • tilt your body, bend your knees, trembling joints - old man
    • change the amplitude of the wave of your arms, legs - get a new mood

    and all this is based on only a single sequence of key frames (!)

    working example, assembled on the knee, you can see here
    the example code here

    Notes:
    • used authorial animation (Jochen Diehl)
    • the slopes in my example work prefabricated - this is because I don’t understand anything in mathematics and in rotation matrices in particular. If some kind person tells me how to correctly calculate the resulting rotation matrix based on the available data (default angle, current angle, data from the slider), I will immediately make changes to the working code and add a bunch of other options for changing the figure


    PS: well - it turned out that the error in calculating the resulting matrix with “slopes” was that instead of degrees, it substituted radians into the matrix. Read the documentation better!
    I reload with corrections.

    Also popular now: