Difference between revisions of "Creating animations"

From XStoryPlayer Wiki
Jump to: navigation, search
Line 6: Line 6:
 
<li>Make sure you have downloaded and installed the [[Using character packs|Character Packs]]. We are using them in this tutorial.<br>
 
<li>Make sure you have downloaded and installed the [[Using character packs|Character Packs]]. We are using them in this tutorial.<br>
 
Also make sure you have the dungeon scene unpacked. We will use that scene as a test scene.</li>
 
Also make sure you have the dungeon scene unpacked. We will use that scene as a test scene.</li>
 +
<li>Open the <code>character6/body.ma</code> file in Maya. You see the poses are stored in keyframes.<br>
 +
Also check out <code>character6/body.ini</code> file. It contains a lot of movies. We will be adding a movie pose that lets the character bend over.</li>
 +
<li>Now we will create a new pose. Use the following Mel script to select all joints (Best is to create a button for it by dragging the script to the toolbar):
 +
<syntaxhighlight lang="cpp">
 +
select -r character ;
 +
select -add hip_left ;
 +
select -add hip_lrot ;
 +
select -add knee_left ;
 +
select -add foot_left ;
 +
select -add hip_right ;
 +
select -add hip_rrot ;
 +
select -add knee_right ;
 +
select -add foot_right ;
 +
select -add spine_bottom ;
 +
select -add spine_mid ;
 +
select -add spine_top ;
 +
select -add neck_joint ;
 +
select -add head_joint ;
 +
select -add shoulder_left ;
 +
select -add arm_left ;
 +
select -add arm_lrot ;
 +
select -add elbow_left ;
 +
select -add hand_left ;
 +
select -add shoulder_right ;
 +
select -add arm_right ;
 +
select -add arm_rrot ;
 +
select -add elbow_right ;
 +
select -add hand_right ;
 +
</syntaxhighlight>
 +
Select frame 300 and to Right Mouse Click - Copy.<br>
 +
Select free frame 11500 and do Right Mouse Click - Paste (Paste).<br>
 +
Now we created a new pose frame and we can adjust the new pose.</li>
 
<li>
 
<li>
 +
Create a bending pose by rotating the joints. When you are finished run this Mel script (Best is to create a button for it by dragging the script to the toolbar):
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
runtime
+
select -r hip_left ;
{
+
setKeyframe "hip_left.rotateY";
  start_mode  = TEST;
+
setKeyframe "hip_left.rotateZ";
 +
 
 +
select -r knee_left ;
 +
setKeyframe "knee_left.rotateY";
 +
 
 +
select -r foot_left ;
 +
setKeyframe "foot_left.rotateY";
 +
setKeyframe "foot_left.rotateZ";
 +
 
 +
select -r hip_right ;
 +
setKeyframe "hip_right.rotateY";
 +
setKeyframe "hip_right.rotateZ";
 +
 
 +
select -r knee_right ;
 +
setKeyframe "knee_right.rotateY";
 +
 
 +
select -r foot_right ;
 +
setKeyframe "foot_right.rotateY";
 +
setKeyframe "foot_right.rotateZ";
 +
 
 +
select -r spine_bottom ;
 +
setKeyframe "spine_bottom.rotateY";
 +
setKeyframe "spine_bottom.rotateZ";
 +
 
 +
select -r spine_mid ;
 +
setKeyframe "spine_mid.rotateY";
 +
setKeyframe "spine_mid.rotateZ";
 +
 
 +
select -r spine_top ;
 +
setKeyframe "spine_top.rotateY";
 +
 
 +
select -r neck_joint ;
 +
setKeyframe "neck_joint.rotateY";
 +
setKeyframe "neck_joint.rotateZ";
 +
 
 +
select -r head_joint ;
 +
setKeyframe "head_joint.rotateX";
 +
setKeyframe "head_joint.rotateY";
 +
 
 +
select -r shoulder_left ;
 +
setKeyframe "shoulder_left.rotateX";
 +
setKeyframe "shoulder_left.rotateZ";
 +
 
 +
select -r arm_left ;
 +
setKeyframe "arm_left.rotateY";
 +
setKeyframe "arm_left.rotateZ";
 +
 
 +
select -r elbow_left ;
 +
setKeyframe "elbow_left.rotateY";
 +
 
 +
select -r hand_left ;
 +
setKeyframe "hand_left.rotateX";
 +
setKeyframe "hand_left.rotateZ";
 +
 
 +
select -r shoulder_right ;
 +
setKeyframe "shoulder_right.rotateX";
 +
setKeyframe "shoulder_right.rotateZ";
 +
 
 +
select -r arm_right ;
 +
setKeyframe "arm_right.rotateY";
 +
setKeyframe "arm_right.rotateZ";
 +
 
 +
select -r elbow_right ;
 +
setKeyframe "elbow_right.rotateY";
 +
 
 +
select -r hand_right ;
 +
setKeyframe "hand_right.rotateX";
 +
setKeyframe "hand_right.rotateZ";
 +
 
 +
select -r arm_rrot;
 +
setKeyframe "arm_rrot.rotateX";
  
  debug_sys    = BASIC;
+
select -r arm_lrot;
  debug_render = NONE;
+
setKeyframe "arm_lrot.rotateX";
  debug_phys  = NONE;
+
  debug_brain  = ENABLED;
+
  
  // Use this directory as second pack directory
+
select -r hip_rrot;
  // (The pack_test.bin is used as primary pack)
+
setKeyframe "hip_rrot.rotateX";
  pack2        = "pack/pack_character";
+
  
  save_key    = "";
+
select -r hip_lrot;
}
+
setKeyframe "hip_lrot.rotateX";
  
// Run this file in test mode
+
select -r character ;
#define TEST_RUN "run_char.ini"
+
setKeyframe "character.translateX";
 +
setKeyframe "character.rotateX";
 +
setKeyframe "character.rotateY";
 +
setKeyframe "character.translateY";
 +
setKeyframe "character.rotateZ";
 +
setKeyframe "character.translateZ";
 
</syntaxhighlight>
 
</syntaxhighlight>
 
</li>
 
</li>
 
</ol>
 
</ol>

Revision as of 11:08, 25 July 2015

In this tutorial you will learn how to add an animation to a character.

Steps

  1. Make sure you have downloaded and installed the Character Packs. We are using them in this tutorial.
    Also make sure you have the dungeon scene unpacked. We will use that scene as a test scene.
  2. Open the character6/body.ma file in Maya. You see the poses are stored in keyframes.
    Also check out character6/body.ini file. It contains a lot of movies. We will be adding a movie pose that lets the character bend over.
  3. Now we will create a new pose. Use the following Mel script to select all joints (Best is to create a button for it by dragging the script to the toolbar):
    select -r character ;
    select -add hip_left ;
    select -add hip_lrot ;
    select -add knee_left ;
    select -add foot_left ;
    select -add hip_right ;
    select -add hip_rrot ;
    select -add knee_right ;
    select -add foot_right ;
    select -add spine_bottom ;
    select -add spine_mid ;
    select -add spine_top ;
    select -add neck_joint ;
    select -add head_joint ;
    select -add shoulder_left ;
    select -add arm_left ;
    select -add arm_lrot ;
    select -add elbow_left ;
    select -add hand_left ;
    select -add shoulder_right ;
    select -add arm_right ;
    select -add arm_rrot ;
    select -add elbow_right ;
    select -add hand_right ;

    Select frame 300 and to Right Mouse Click - Copy.
    Select free frame 11500 and do Right Mouse Click - Paste (Paste).

    Now we created a new pose frame and we can adjust the new pose.
  4. Create a bending pose by rotating the joints. When you are finished run this Mel script (Best is to create a button for it by dragging the script to the toolbar):
    select -r hip_left ;
    setKeyframe "hip_left.rotateY";
    setKeyframe "hip_left.rotateZ";
     
    select -r knee_left ;
    setKeyframe "knee_left.rotateY";
     
    select -r foot_left ;
    setKeyframe "foot_left.rotateY";
    setKeyframe "foot_left.rotateZ";
     
    select -r hip_right ;
    setKeyframe "hip_right.rotateY";
    setKeyframe "hip_right.rotateZ";
     
    select -r knee_right ;
    setKeyframe "knee_right.rotateY";
     
    select -r foot_right ;
    setKeyframe "foot_right.rotateY";
    setKeyframe "foot_right.rotateZ";
     
    select -r spine_bottom ;
    setKeyframe "spine_bottom.rotateY";
    setKeyframe "spine_bottom.rotateZ";
     
    select -r spine_mid ;
    setKeyframe "spine_mid.rotateY";
    setKeyframe "spine_mid.rotateZ";
     
    select -r spine_top ;
    setKeyframe "spine_top.rotateY";
     
    select -r neck_joint ;
    setKeyframe "neck_joint.rotateY";
    setKeyframe "neck_joint.rotateZ";
     
    select -r head_joint ;
    setKeyframe "head_joint.rotateX";
    setKeyframe "head_joint.rotateY";
     
    select -r shoulder_left ;
    setKeyframe "shoulder_left.rotateX";
    setKeyframe "shoulder_left.rotateZ";
     
    select -r arm_left ;
    setKeyframe "arm_left.rotateY";
    setKeyframe "arm_left.rotateZ";
     
    select -r elbow_left ;
    setKeyframe "elbow_left.rotateY";
     
    select -r hand_left ;
    setKeyframe "hand_left.rotateX";
    setKeyframe "hand_left.rotateZ";
     
    select -r shoulder_right ;
    setKeyframe "shoulder_right.rotateX";
    setKeyframe "shoulder_right.rotateZ";
     
    select -r arm_right ;
    setKeyframe "arm_right.rotateY";
    setKeyframe "arm_right.rotateZ";
     
    select -r elbow_right ;
    setKeyframe "elbow_right.rotateY";
     
    select -r hand_right ;
    setKeyframe "hand_right.rotateX";
    setKeyframe "hand_right.rotateZ";
     
    select -r arm_rrot;
    setKeyframe "arm_rrot.rotateX";
     
    select -r arm_lrot;
    setKeyframe "arm_lrot.rotateX";
     
    select -r hip_rrot;
    setKeyframe "hip_rrot.rotateX";
     
    select -r hip_lrot;
    setKeyframe "hip_lrot.rotateX";
     
    select -r character ;
    setKeyframe "character.translateX";
    setKeyframe "character.rotateX";
    setKeyframe "character.rotateY";
    setKeyframe "character.translateY";
    setKeyframe "character.rotateZ";
    setKeyframe "character.translateZ";