Go to: Synopsis. Return value. Related. Python examples.
viewHeadOn(
[camera]
)
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
viewHeadOn is undoable, queryable, and editable.
The viewHeadOn command positions the specified camera so it is looking "down" the normal of the live object, and fitted to the live object. If the live object is a surface, an arbitrary normal is chosen.import maya.cmds as cmds # Create a new camera cam = cmds.camera() camera = cam[0] # Create a polygonal cone, rotate it, make it live object = cmds.polyCone( ax=(0, 1, 0) ) cmds.rotate( 15, 30, 45 ) cmds.makeLive( object[0] ) cmds.viewHeadOn( camera ) cmds.makeLive( none=True )