HW4 - Kinematics
HW4 - Kinematics
Part 0
Code Framework (10 points)
Please submit your Part 0 answers in the form of an MSWord or pdf doc to the HW4 Assignment folder in the CIS4620/5620 Canvas site.
After downloading the assignment code framework from Github, it is recommended that you look through the FK/IK project codebase to better understand the object-oriented software design and the program execution model. In order to keep you honest, please answer the questions below:
1. (5 points):
What is the data hierarchy (not the class hierarchy) of AJoint, ASkeleton, AActor, ATransform, BVHController, IKController? Please write it using the following format.
For example:
- ClassA
- ClassB
- ClassC
- ClassD
- ClassE
- ClassF
- ClassB
In the example above, Class A stores data with the type of Class B and ClassD; ClassB stores data with type ClassC, etc.
- AActor
- ASkeleton
- AJoint
- ATransform
- AJoint
- BVHController
- IKController
- ASkeleton
Besides, IKController stores AIKchain which also stores AJoint, and AActor also stores AJoint for the root joint.
2. (5 points)
How many quaternion splines and vec3 splines are used for the Beta character animation? Which function is responsible for initializing these splines? Hint: Set break points in the debugger and step through the code to find the answer.
For quaternion splines: 66,
which is the number joint in skeleton
For vec3 splines: 1,
only one spline for the root
loadMotion
is responsible for initializing these splines.
bool BVHController::loadMotion(std::ifstream& inFile)
void BVHController::loadFrame(std::ifstream& inFile)
Firstly, loadMotion
initialize the quaternion splines for each joint in skeleton and the vec3 spline for root. Then, loadMotion
call loadFrame
for each frame. loadMotion
add key for each quaternion splines for each joint and vec3 splines for the root at this frame.
Part 3
Unity Plugin (50 points)
1. Guide Joint. 25
After each walk cycle, the character will go back to the origin. To solve this problem, we add a guide joint in the AActor class. It is a virtual joint which you can consider as the parent joint of the root joint (the Hips). In other words, the transform of the character’s root joint will be with respect to the guide joint’s space instead of the world space. Before each walking cycle, you need to update the position of the guide joint to where the character is. The process is:
- Set the global position of the guide joint to the global position of the root joint
- Walk Cycle 1
- Set the global position of the guide joint to the global position of the root joint
- Walk Cycle 2
- ……
Implement AActor::updateGuideJoint
. You need to update the orientation of the guide joint as well so that the character can face towards the target position at the beginning of each walk cycle.
2. Foot IK. 25
In each frame, we will use ray casting in Unity to get the height (y value) and the normal of the terrain at the position of the left foot and the right foot of the beta character. Implement AActor::solveFootIK
to update the character with Limb-based IK and update the orientation of the feet based on the surface normal and the forward direction of the foot so that the character can always stand on the terrain. Note that the normal and the height given are in the world space. Note: given the terrain height you need to first update the transform of the root\hips joint before applying the foot IK modifications.