Using ArmatureUnity.py will create a rig with IK constraint ready for Unity Mecanim.
Script could be optimized, but works okay for now
Efforts have been put into a script that can generate automatic animations. Here's how it works:
- The script creates a class based on the armature generated by
ArmatureUnity.py - If you need to create more animations, you'll have to set an initial pose, which is the T-pose (because this program computes the difference between current pose and initial pose). In this case, run the script once with the argument
load = False. Make sure you specify the path in the initialization of the instance. - Methods are being designed to create keyframes of animation, theoretically usable over many different sized rigs because description of the movement is based on arms and legs length
Create your animation as usual, using keyframes. Then, for each step, use the print_pose method to get a log on the console with what you should copy in a new method. This implies running the script multiple times with the initial pose recorded. I'll try to post a tutorial soon but basically:
- Run the script for the first time with
load = False. Create the initial pose data (this saves a pickle file in the path chosen) - For an smoother workflow, create your full animation in a temporary action data
- For each frame where a keyframe is inserted do the following:
- Move the cursor to the frame. Run the script with
load = True(make sure the only method called isprint_pose) - In the terminal, you'll see a print which you just need to copy and paste in your animation method
- After pasting, call the confirmation method, and specify number of frames to move on forward
- Move on to the next keyframe
- Move the cursor to the frame. Run the script with
You can use existing animations methods for example and inspiration. Of course, the workflow could be improved and I'm thinking about it.
Modify the script:
- Comment
print_pose()method - Call whichever animation method you wish. For instance
RunMale,IdleCombat...
-
Think of a better way to structure the code. One idea would be to record movements in pickable objects rather than writing them in code
-
Is it possible to use the F-curves ?
-
Add path selection in the main method