Yeah, xXxGuitar is right; with bones it works without any problems.

I am using the code for the rotatable turrets of some space battleships.
The turrets are rotated by two bones, whereby one bone handles pan rotation and the other tilt rotation.

However, as frazzle said, this rotation stuff doesnt work properly when the models pan and tilt angles are altered directly.

Well, I'm not much of a mathematician, so I dont know whats going on there. ;-)