Saturday, September 25, 2010

The animation problem SOLVED! (Finally)

Ok, so I've worked out what I think is a solution to the animation problems we've been having with the projectile weapons this week.

The problem was caused because UDK doesn't accept any translation information for joints. Animations are created with only rotations. It didn't come up with the melee weapons because that all happened with rotation.

So anyway here's some quick instructions on how to rig objects so they can move freely without having to worry about the rotations.

The rig is probably fairly obvious when you look at it, but I'll explain it anyway.
Basically it creates an arm which allows for free movement of the object.

The picture is of the rig I used to work out how I'd be moving the arrow freely in the bow's firing animation. But the basic principal should work fine for any other weapon with minor tweaking.

Joint 1 is the root of the skeleton, it doesn't move. This would be parented to the Spine bone of the arm skeleton in the final rig. It's important to create this separately from the spine because the IK would affect the rest of the rig otherwise.

Joint 2 and 3 act as the arm's elbows, and Joint 4 acts as the bone controlling the weapon. In my rig the cylinder is 100% weighted to Joint 4.

The two IK handles run between Joints 1 & 3 and Joints 2 & 4. The ends of the IK handles at 3 and 4 are both joined to the controller via Constraints>Parent. It's important to parent the IK and NOT the joint because otherwise the joint will not rotate when the controller is moved.

Setting it up this way, the two IK handles counteract each other and keep the bone between 3 and 4 level as you move around the controller. Rotating the controller rotates the arrow. In my rig it's set up so that the arrow always points at the controller, but putting it in the middle would cause it to rotate around from that point.

This way you can move the arrow (Or whatever) completely independently of the rest of the rig. When it goes behind the character the arm might go crazy, but since it's not visible it won't matter.

Hopefully that makes sense to you all.

Basically to TL;DR it for you:
  • Only rotation values work on joints in UDK, not translation.
  • Bones won't stretch at all.
  • Use IK and Controllers to make the joints rotate without having to key all the rotations manually.
  • To rotate properly use constrain>parent on the IK handle, NOT the joint. It will look fine in Maya but won't export.
  • Will is very, very tired.

No comments:

Post a Comment