| MATLAB Function Reference | ![]() |
Position the camera to view an object or group of objects
Syntax
Description
camlookat(object_handles)
views the objects identified in the vector object_handles. The vector can contain the handles of axes children.
camlookat(axes_handle)
views the objects that are children of the axes identified by axes_handle.
camlookat
views the objects that are in the current axes.
Remarks
camlookat moves the camera position and camera target while preserving the relative view direction and camera view angle. The object (or objects) being viewed roughly fill the axes position rectangle.
camlookat sets the axes CameraPosition and CameraTarget properties.
Examples
This example creates three spheres at different locations and then progressively positions the camera so that each sphere is the object around which the scene is composed:
[x y z] =sphere; s1 = surf(x,y,z); hold on s2 = surf(x+3,y,z+3); s3 = surf(x,y,z+6);daspect([1 1 1])view(30,10)camprojperspective camlookat(gca) % Compose the scene around the current axes pause(2) camlookat(s1) % Compose the scene around spheres1pause(2) camlookat(s2) % Compose the scene around spheres2pause(2) camlookat(s3) % Compose the scene around spheres3pause(2) camlookat(gca)
See Also
Controlling the Camera Viewpoint for related functions
Defining Scenes with Camera Graphics for more information
| camlight | camorbit | ![]() |