TrackTo problem

http://www.gorilla3d.com/plantperson/mockup.blend

As you can see, I have a camera with an empty parented to it, which is supposed to track to the cursor object. This works fine at first, until I rotate the empty the camera is parented to. Then the empty stops tracking to the cursor, and starts pointing in a different direction instead. Why is this? What can be done about it?

Left arrow to rotate view, mouse to move cursor, click to fire.

The problem is that the camera tracks, then the parent’s transformation is applied. To fix the problem, this would have to be done in the opposite order somehow. I guess it’s a bug.

Can you suggest a solution? The ability to do this is extremely important to my game concept.

I remember somewhere a series of scripts that would dynamically parent an arrow to a rotating cube. You could take that and figure out a way to, instead of copying a parent’s transformation, undoing it.

Maybe useful:
http://blenderartists.org/forum/showthread.php?t=79784