camtarget - Set or query location of camera target

Syntax

camtarget
camtarget([camera_target])
camtarget('mode')
camtarget('auto')
camtarget('manual')
camtarget(axes_handle,...)

Description

The camera target is the location in the axes that the camera points to. The camera remains oriented toward this point regardless of its position.

camtarget with no arguments returns the location of the camera target in the current axes.

camtarget([camera_target]) sets the camera target in the current axes to the specified value. Specify the target as a three-element vector containing the x-, y-, and z-coordinates of the desired location in the data units of the axes.

camtarget('mode') returns the value of the camera target mode, which can be either auto (the default) or manual.

camtarget('auto') sets the camera target mode to auto.

camtarget('manual') sets the camera target mode to manual.

camtarget(axes_handle,...) performs the set or query on the axes identified by the first argument, axes_handle. When you do not specify an axes handle, camtarget operates on the current axes.

Remarks

camtarget sets or queries values of the axes object CameraTarget and CameraTargetMode properties.

When the camera target mode is auto, the camera target is the center of the axes plot box.

Examples

This example moves the camera position and the camera target along the x-axis in a series of steps:

surf(peaks); 
axis vis3d
xp = linspace(-150,40,50);
xt = linspace(25,50,50);
for i=1:50
     campos([xp(i),25,5]);
     camtarget([xt(i),30,0])
     drawnow
end

See Also

axis, camproj, campos, camup, camva

The axes properties CameraPosition, CameraTarget, CameraUpVector, CameraViewAngle, Projection

Camera Viewpoint for related functions

Defining Scenes with Camera Graphics for more information

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS