# [Bf-funboard] Track constraint proposal

Matthew H. Plough mplough at Princeton.EDU
Thu Oct 12 08:23:06 CEST 2006

```I propose an extension to the Track constraint that would allow the
"up" direction to be specified intuitively, while also allowing it to
be animated.

The Track constraint is not affine invariant.  It needs to be; there
is a unique "up" direction.

One common use for tracking is to create a target camera -- instead
of directly specifying the camera rotation, the user specifies it
indirectly by placing an empty where the camera should look and
causing the camera to track the empty.

Right now, this has two parts:
1) The camera looks at the empty.  The camera is rotated so that its
y axis (for example) points toward the empty.
2) A global "up" axis, generally the global z axis, then constrains
the rotation about the camera's local y axis, providing a steady camera.

Consider the implementation of part 2:

Let the line through the camera's location and the empty's location
be called line L.  Let a plane normal to L be called P.  Let the
projection of the global z axis onto P be called U, for "up".

The camera is rotated about its y axis until U is parallel to the
camera's local z axis.  This works fine until L is nearly parallel to
the global z axis.  When this happens, U is nearly zero length, and
the camera rotates wildly.

For scenes shot indoors, or outdoor scenes without a lot of motion,
this implementation works fine.  It's really bad, though, when the
camera does a lot of maneuvering -- what if I want my shot to fly in
a half-circle, and then straight down a hole?  The camera will rotate
like crazy unless I painstakingly align things manually, which is
time consuming and inefficient.

A simple extension to the current implementation would work great.
Instead of using a global "up" axis, use a local "up" axis; allow the
tracked empty's z axis to supply the "up" direction.

Now, instead of projecting the global z axis onto P, the empty's
local z axis would be projected onto P.  This way, when I fly the
camera down a hole, all I have to do is rotate the empty through 90
degrees, thereby keeping U nondegenerate, and making the necessary
rotation about the camera's y axis unambiguous and stable.  Also, as
I'm flying the camera around, I can bank it by rotating the empty
left to right.

Any crits?

Cheers,
Matt
```