Go to: Synopsis. Return value. Related. Python examples.
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
viewHeadOn is undoable, NOT queryable, and NOT 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 # Create a polygonal cone, rotate it, make it live object = cmds.polyCone( ax=(0, 1, 0) ) cmds.rotate( 15, 30, 45 ) cmds.makeLive( object ) cmds.viewHeadOn( camera ) cmds.makeLive( none=True )