This command positions the camera as specified. The lookAt and viewDirection flags are mutually exclusive, as are the ortho and perspective flags. If this command switches a camera from ortho to perspective or the other way around without specifying a new field of view, then one is calculated based on a heuristic involving the selected objects. If the camera is not specified on the command line, the command will check to see if there is a camera on the active list. The user should be aware that some positions will be unattainable. For example, using a new camera located at the origin and specifying a lookAt of [0 0 -5] and an up of [1 1 1]. In these cases, the camera will always aim at the lookAt, and the new up direction will be determined by transforming the specified up into camera space and then projecting this vector onto a plane defined by the camera’s up and right vectors. Using the example above, the new up vector will be [1 1 0].
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
animate (an) | bool | ||
eyePoint (eye) | float, float, float | ||
|
|||
fieldOfView (fov) | float | ||
|
|||
lookAt (la) | float, float, float | ||
|
|||
ortho (o) | bool | ||
|
|||
perspective (p) | bool | ||
|
|||
upDirection (up) | float, float, float | ||
|
|||
viewDirection (vd) | float, float, float | ||
|
Derived from mel command maya.cmds.viewPlace
Example:
import pymel.core as pm
import maya.cmds as cmds
# Create a new camera
cam = pm.camera();
camShape = cam[1];
pm.viewPlace( camShape, p=True, fov=20 )
pm.viewPlace( camShape, eye=(0, 0, 20) )
pm.viewPlace( camShape, la=(0, 0, 0) )