Skip to Main Content Skip to Search
Product Documentation

camtarget - Set or query location of camera target

Syntax

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

Description

camtarget returns the location of the camera target in the current axes. 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([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 (default) or manual.

camtarget('auto') sets the camera target mode to auto. When the camera target mode is auto, the camera target is the center of the axes plot box.

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

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

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

Examples

Move 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

Axes: CameraPosition | Axes: CameraTarget | Axes: CameraUpVector | Axes: CameraViewAngle | Axes: Projection | axis | campos | camup | camva

How To

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS