Image 01
While you can’t restrict the direction constraint to a single axis per se, using an extra object as a buffer will create the desired result.
As you’ve noticed there isn’t a one click solution to limit the direction constraint to a single axis. However there’s no need to despair as we’ve supplied you with two different methods to tackle the problem.
Open the scene Surveillance_Camera.scn from this issues DVD. The first method requires two null objects, one which can be moved in any direction and one that will be used for the actual direction constraint. Create a null object, name it Direction_Cns and move it somewhat in front of the surveillance camera. Create another null object, name it LookAt and move it in front of the camera as well. Press [Ctrl] + [K] to pen its Local Transforms PPG and click the Lock icon to pin it to the screen. Select the Direction_Cns object and press [Ctrl] + [K] to open its transform PPG as well. Click and drag the animation icon (the green divot) from the X Position in the LookAt PPG and drop it on the X Position animation icon in the Direction_Cns PPG. By dragging and dropping an animation icon from one parameter to another creates an equal expression, meaning the second parameter will match the exact same value as the first. Drag and drop the Z Position of the LookAt to the Z position of the Direction_Cns and close the PPG’s. Select the Camera_Orientation and from the Constrain menu choose Direction. Pick the Direction_Cns when prompted. Select and move the LookAt object to change the direction of the Surveillance_Camera. Save your scene under a new name.
The second method uses a somewhat different approach but has the same outcome. Open the Surveillance_Camera.scn again. Create a null object, name it Direction_Cns and position it straight above the camera. Create a second null, name it LookAt and position it in front of the camera. Select the Camera_Orientation object and from the Constrain menu choose Direction. When prompted, pick the Direction_Cns. Click the Y button in the Align Axis section of the Direction Cns PPG to correct the cameras orientation. Switch to the Up Vector tab. In the Optional Up Vector Control Object section, click the Pick New button and pick the LookAt object. Select Z as the Affected axis and close the PPG. While the direction is constrained to the Direction_Cns object, the added up vector gives you the final control of the cameras orientation. Select and move the LookAt object to change the direction of the Surveillance_Camera.
The project files used in this tutorial can be found at:
http://www.redi-vivus.com/Caffeineabuse/Direction_Constraint.zip
Image 02
The other way around it is to have the constraint pointing to a dummy object and then the up vector as the actual target for the direction.
Quick tip
In addition to naming convention it’s a good practice to use different colors and/or icons on your null objects. This way you can easily tell what objects does what by just looking at your scene.
Read the full post>>