February 23rd, 2014

This week I worked on (1) joint selection, (2) moving/rotating objects and their children, (3) trackpad controls, and (4) importing a smoother version of my model.

I set up joint selection so that when the mouse is clicked, a ray is cast through the scene.  When the ray intersects an object, it adds it to an array containing all of the intersected objects.  Then, it checks if any of the intersected objects are joints, and if so, returns the closest one.  If a joint was intersected, and if it is different than the previously selected joint, the material of the old joint gets set back to the default and the newly selected joint gets a color applied to it.  Once a joint has been selected, the user can rotate the object chain starting at the selected joint.  This means that when the shoulder joint is rotated, the upper arm, elbow, and lower arm also rotate. If the root is selected, the entire figure can be rotated or translated.

In addition to selection, I also set up trackpad controls to manipulate the camera.  To do this, I used the three.js plugin that handles trackpad controls.  This plugin zooms in with trackpad scrolling, and rotates on the click & drag.  I switched the camera controls from the keyboard to the trackpad to free up keys to use to manipulate the mannequin's joints.  I may wind up adjusting, or writing my own trackpad functionality in the next couple of weeks, to ensure the control works how I want it to, and to prevent a mouse click being read as a camera rotation instead of a joint selection.  

Finally, this week I imported smoother version of my model. The smoothing was just done in Maya, and then saved to an OBJ file.  While working on joint selection, I realized that all of the objects I wanted to import needed to be saved at the origin of the Maya scene, and then once imported have their position set relative to their parent object.  Because I had to go through and re-save all of the Maya objects, I decided to smooth each mesh to make it look more visually appealing in my app.

Next week I plan on working on a simple, relatively bare bone UI to handle joint selection and manipulation in a visual way (in addition to the current trackpad/keyboard set up).  I will also begin reading up on joint limitation algorithms, and starting to look for pose data I can later import and apply to my model.