stopping joint animation/attaching things to joints

I have an animated character and can control any joint with lateUpdate(). That means I'm always updating that joint to the same spot, however. I just want to place a few joints of a character initially, based on some user selections (e.g. hat placement), then tell those joints to stop animating. They would still need to move with their parents, of course, just not move of their own accord.

Also, is there a standard method to attach an object to another, e.g. a separate hat object to an animated head joint, so it follows along with the head?


Edit: I found the answer to the 2nd question here:

I had searched before, but somehow missed it.

Yes and no :)

If animation contains tracks for particular joint these joints will be animated (even if animation is empty/const - it still counts as animation), so there are several approaches:

  1. Remove animation tracks from these joints (you can either try not to export them from your 3d tool when exporting animations or remove them by script in AssetPostprocessor)
  2. Override position of these joints in every frame