My main frustration with 3D is not being able to animate 3D models, eg wave their arms around or walk. Programs like Blender do it by providing “armatures” (effectively bones) which you can put inside a 3D figure and then move around, and the program figures out how to distort your mesh. But you can’t export the armatures to anything Codea can use, and Codea wouldn’t know what to do with them anyway.
So because I like an insane challenge, I am building a rigging program in Codea. I’ve defined a number of body joints, and created “bones” that run between them. The model’s mesh will need to be broken into pieces, one for each bone. Then as the joints move, the body pieces and meshes will change direction along with them.
Each animation will require a number of frames, which means setting and storing x,y,z positions for each joint, for each frame. The playback program can then play back the frames, positioning and rotating the body meshes.
There is, of course, a lot of work setting positions for nearly 20 joints, for every frame, and making all the body parts move together. That’s why Blender has armatures and all sorts of helper functions. So I’ve created the best approximation I can.
My rigging program allows me to use Codea to drag joints in 3D, to position the body to create one frame of an animation, save the positions, and then do the next frame, just as you do in Blender. Codea can then play back the animation in any of my other 3D programs, to create the effect I want.
The hard part is keeping the body parts moving coherently, so if you move the foot, it doesn’t detach from the leg, or bend the leg the wrong way. I believe this is known as inverse kinematics, or IK. I’m including some IK in my program for arm and leg movements.
Initially, I’m just using a body without a mesh, and my progress is shown in the video below. Clearly, there is a lot of work to go, but I thought I’d share it for anyone who is interested.