I am trying to figure out how I can animate my character relative to an object (the foot object) easily. My models are using a very simple old school approach, in which they do not use a skeleton but the animations rely on solely keyframes. My previous solution was to just modify each animations frame by frame using the autokey feature in 3ds Max to simulate the foot locking effect for all motions. I did this by moving the root node of my character (the torso) frame by frame so that it matched with the original starting position of the desired foot. This however, takes WAY too long to accomplish for multiple animations/motions and is very tedious.
More info:
My characters use separate meshes for each body part. The root node which defines how the animations operate is the torso object. When the torso object is moved (root), the entire rest of the meshes move with it.
I also need to be able to switch which foot is locked depending on the weapon that is being used. Example: When the handgun is equipped it should be locked to the left foot, but when the shotgun is equipped it is locked to the right, etc.
What is the best way to go about doing this? I’ve looked into Foot IK with Mecanim but to be honest I never used Mecanim and I don’t think it’ll work for these models. The other way is to maybe translate (move) the root node little by little per frame for each animation in code but this again will take FAR too long and it’ll be a huge recipe for messy goo code with multiple animations.
The best way to describe what I want to accomplish: The idle pos has the correct foot placement at frame 0. I want to blend the shotgun pos with the idle pos’s foot position. See the example
attachments.
Seems the struggles are caused by not embracing rigging and skinning.
It’s understandable - skinning in particular is a pain in the butt followed closely by rigging - especially when all you want to do is get to the fun part - animating!
Seems like you’ve gotten a little ways with the process your are currently using, but I think you’d save time/energy/brain matter/windows/hair and hours upon hours of frustration if you rigged and skinned the character and worked with the built in IK systems - which really make life much better - rather than counter animating objects in FK - which is your current process.
You could accomplish the rigging and skinning pretty easily by creating a base biped or CAT rig with the bone joints at the exact location you currently have your rotation joints for each piece.
You will want to combine all the pieces into one before skinning, so just create and align dummy or point objects at the location the separate body pieces are currently at. These are only place holders so you can align the bones to the pivot points you already have for each separate piece.
Since your character is segmented skinning is a breeze. After attaching all the pieces together, adjust the mesh pivot near the crotch and apply the skin and weight each separate element to each bone 100%. You can select by element so all verts will be selected at once, and then invert the selection and zero any vert weighting on other pieces.
This will give you the benefit of having IK and foot locking while animating. Additionally you can also IK blend weapons to the hand easily and even IK lock hands to other surfaces or the world so the character can push on things with realistic weighted posing.
If using biped there are too many enhanced animation tools to mention - so just know it’s totally worth it to rig this character. CAT also has tons of benefits over straight FK animating.
If you break and choose biped make sure the legs are parented to the pelvis instead of the first spine bone (default). Modify this under the biped display rollout - uncheck triangle pelvis. And also check triangle neck. This parents the clavicles to the top spine bone instead of the default neck bone. (mystery why that was ever a good default setup)
To answer your question regarding blending the two poses - the best way is to animate him taking a step - into the shotgun pose while drawing the weapon. Either have him take a step forward with his right foot while drawing the weapon, or have him step back with his left when he draws the weapon.
Edit - animating relative another object in FK can only be accomplished with either advanced animation controllers - or setting up IK controls.
OR - adding dummy objects to the hierarchy and parenting the segmented pieces of the character to them and animate the dummy objects, while still being able to animate the segments. I don’t know how Unity would like this type of nonskinned hierarchy.
It’d be easier and more beneficial to rig the character though.