Request

Response

    Core

    Autodesk.Viewing.Navigation

    new Navigation(camera)

    This is the core interface to camera controls and navigation. The active navigation object can normally be obtained from the “navigation” property of the Viewer3D instance. Client implementations should not normally instantiate this class directly.

    Parameters

    camera*
    THREE.Camera
    The main camera object used to render the scene.
    * Required

    Methods

    computeFit(oldpos,oldcoi,fov,bounds,aspect)

    Compute camera position and look at point which will fit the given bounding box in the view frustum at the given field of view angle.

    Parameters

    oldpos*
    THREE.Vector3
    existing camera position
    oldcoi*
    THREE.Vector3
    existing camera look at point
    fov*
    number
    field of view (in degrees) to use for fit calculation in degrees
    bounds*
    THREE.Box3
    bounding box to fit
    aspect*
    number
    optional aspect ratio of window, horizontal/vertical
    * Required

    Returns

    TypeDescription
    Object Object with properties “position” and “target”.

    computeOrthogonalUp(pos,coi)

    Compute a vector which is orthogonal to the given view and aligned with the world up direction.

    Parameters

    pos*
    THREE.Vector3
    view position
    coi*
    THREE.Vector3
    center of interest (view look at point)
    * Required

    Returns

    TypeDescription
    THREE.Vector3 up direction orthogonal to the given view

    dollyFromPoint(distance,point)

    Dolly the camera a distance along the vector from a given point to its current position. The dolly distance is clamped to not go past the point.

    Parameters

    distance*
    number
    World space distance to move the camera by.
    point*
    THREE.Vector3
    World space position used to define the dolly direction.
    * Required

    fitBounds(immediate,bounds,reorient)

    Causes the current camera position to be changed in order to fit the given bounds into the current view frustum.

    Parameters

    immediate*
    boolean
    if false the camera position will animate to the new location.
    bounds*
    THREE.Box3
    bounding box to fit
    reorient*
    boolean
    if true the camera up direction will be reoriented with the world up.
    * Required

    Returns

    TypeDescription
    Object Object with properties “position” and “target”.

    fl2fov(fl)

    Convert a 35mm camera focal length value to a vertical field of view angle in degrees.

    Parameters

    fl*
    number
    focal length in millimeters
    * Required

    Returns

    TypeDescription
    number vertical field of view in degrees

    fov2fl(fov)

    Convert a vertical field of view angle in degrees to a 35mm camera focal length value.

    Parameters

    fov*
    number
    vertical field of view in degrees
    * Required

    Returns

    TypeDescription
    number focal length in millimeters

    getAlignedUpVector()

    Get the world space vector which is the orthogonal to the view direction and aligned with the world up direction.

    Returns

    TypeDescription
    THREE.Vector3 the current camera up direction (normalized)

    getCamera()

    Returns

    TypeDescription
    THREE.Camera
    • the current camera object.

    getCameraRightVector(worldAligned)

    Get the world space vector which is the right side direction of the current camera.

    Parameters

    worldAligned*
    boolean
    if true get the right vector aligned with the world up, otherwise use the current camera’s up direction.
    * Required

    Returns

    TypeDescription
    THREE.Vector3 the current camera right direction, orthogonal to view and up (normalized)

    getCameraUpVector()

    Get the world space vector which is the current cameras up direction.

    Returns

    TypeDescription
    THREE.Vector3 the current camera up direction (normalized)

    getEyeToCenterOfBoundsVec(bounds)

    Get a vector from the camera location to the center of the input bounding box.

    Parameters

    bounds*
    THREE.Box3
    Bounding box.
    * Required

    Returns

    TypeDescription
    THREE.Vector3
    • The vector from the camera location to the center of the input bounds.

    getEyeVector()

    Get the current camera view vector. This vector is not normalized and its length is the distance between the camera position and the camera look at point.

    Returns

    TypeDescription
    THREE.Vector3 the current camera view vector in world space.

    getFocalLength()

    Returns

    TypeDescription
    number the current camera focal length based on a 35mm camera lens model

    getFovMax()

    Returns

    TypeDescription
    number the maximum allowed vertical field of view in degrees.

    getFovMin()

    Returns

    TypeDescription
    number the minimum allowed vertical field of view in degrees.

    getHorizontalFov()

    Returns

    TypeDescription
    number the current camera horizontal field of view in degrees

    getIsLocked()

    Get the state of the current view modification lock. For a more granular control of locked operations, see setLockSettings.

    Returns

    TypeDescription
    boolean
    • true if view modifications are not currently allowed.

    getLockSettings()

    Get the availability of specific camera actions when navigation is locked using setIsLocked.

    Returns

    TypeDescription
    object Map of : pairs specifying whether the given camera action is enabled even when the navigation is locked.

    getOrbitPastWorldPoles()

    Get the state of the view navigation option that allows orbit controls to continue past the world up/down direction.

    Not applicable to 2D.

    Returns

    TypeDescription
    boolean
    • value of the option, true if orbiting past the poles is allowed.

    getPivotPlaneDistance()

    Returns

    TypeDescription
    number
    • The perpendicular distance from the camera to the plane containing the pivot point.

    getPivotPoint()

    Returns

    TypeDescription
    THREE.Vector3 the world space position of the pivot point for orbit navigation.

    getPivotSetFlag()

    Get the state of the view navigation option that indicates the pivot is set.

    Returns

    TypeDescription
    boolean
    • value of the option, true if pivot may be used.

    getPosition()

    Returns

    TypeDescription
    THREE.Vector3 the world space position of the camera.

    getRequestFitToView()

    Get the state of the view navigation option requesting a camera repositioning to fit the active model data. Value will be false if a request has not been made or if having been made has been received and acted upon.

    Returns

    TypeDescription
    boolean
    • current state of the request.

    getRequestHomeView()

    Get the state of the view navigation option requesting a camera change to the current “home” view. Value will be false if a request has not been made or if having been made has been received and acted upon.

    Returns

    TypeDescription
    boolean
    • current state of the request.

    getRequestTransition()

    Get the state of the view navigation option requesting a camera transition to a new view.

    Returns

    TypeDescription
    Object
    • If a transition request is active, an object with properties “position” (Vector3), “coi” (Vector3), “fov” (Number), “up” (Vector3), “worldUp” (Vector3), “reorient” (boolean). Returns null when no transition is active.

    See

    • setRequestTransitionWithUp

    getReverseHorizontalLookDirection()

    Get the state of the view navigation option which requests the reversal of the default horizontal look direction

    Not applicable to 2D.

    Returns

    TypeDescription
    boolean value of the option, true for reverse, false for default

    getReverseVerticalLookDirection()

    Get the state of the view navigation option which requests the reversal of the default vertical look direction

    Not applicable to 2D.

    Returns

    TypeDescription
    boolean value of the option, true for reverse, false for default

    getReverseZoomDirection()

    Get the state of the view navigation option which requests the reversal of the default direction for camera dolly (zoom) operations.

    Returns

    TypeDescription
    boolean
    • value of the option, true for reverse, false for default

    getScreenViewport()

    Get the current canvas viewport in screen coordinates.

    Returns

    TypeDescription
    Object with properties left, top, width, height.

    getTarget()

    Returns

    TypeDescription
    THREE.Vector3 the world space position towards which the camera is pointing.

    getTransitionActive()

    Check the status of a view transition request.

    Returns

    TypeDescription
    boolean
    • value of the transtion status

    getUseLeftHandedInput()

    Get the state of the view navigation option that requests mouse button reversal.

    Returns

    TypeDescription
    boolean
    • value of the option, true if reversal is requested.

    getUsePivotAlways()

    Get the state of the view navigation option that requests full use of the pivot point.

    Returns

    TypeDescription
    boolean
    • value of the option, if the pivot should be used as the orbit origin.

    getVerticalFov()

    Returns

    TypeDescription
    number the current camera vertical field of view in degrees

    getWorldPoint(x,y)

    Get a world point from normalized screen coordinates by projecting to the plane at the pivot point.

    Parameters

    x*
    number
    Normalized screen X coordinate in [0, 1] range (left == 0)
    y*
    number
    Normalized screen Y coordinate in [0, 1] range (top == 0)
    * Required

    Returns

    TypeDescription
    THREE.Vector3
    • Point in world space

    getWorldRightVector()

    Compute a world right direction based on the current world up direction. This will return the normalized cross product of the current up direction with one of the major axes to provide a usable world right direction.

    Returns

    TypeDescription
    THREE.Vector3 the computed world right direction

    getWorldSize(atDistance)

    Parameters

    atDistance*
    number
    Distance from the camera at which to compute the view frustum size.
    * Required

    Returns

    TypeDescription
    THREE.Vector2 The size of the view frustum at this distance from the camera.

    getWorldUpVector()

    Get the current world up direction.

    Returns

    TypeDescription
    THREE.Vector3 the current world up direction (normalized)

    getZoomTowardsPivot()

    Get the state of the view navigation option that requests the default direction for camera dolly (zoom) operations to be towards the camera pivot point.

    Returns

    TypeDescription
    boolean
    • value of the option, true for towards the pivot, false for default

    isActionEnabled(action)

    Check the availability of a camera action.

    Parameters

    action*
    string
    Camera action.
    * Required

    Returns

    TypeDescription
    boolean True if the camera action is currently enabled.

    isPointVisible(point)

    Returns true if the point is visible.

    Parameters

    point*
    THREE.Vector3
    The point in world coordinates.
    * Required

    Returns

    TypeDescription
    boolean
    • True if the point is within the camera’s frustum.

    orientCameraUp()

    Orient the camera’s up direction with the current world up direction

    panRelative(deltaX,deltaY,atDistance)

    Pan the camera a relative distance up/down or left/right.

    Parameters

    deltaX*
    number
    Normalized X distance to pan left/right (negative/positive).
    deltaY*
    number
    Normalized Y distance to pan down/up (negative/positive).
    atDistance*
    number
    Pan distance is scaled by the size of the view frustum at this distance from the camera.
    * Required

    setCamera(camera)

    Set or unset the current camera used for navigation. Normally set via the constructor. The camera should be of type Autodesk.Viewing.UnifiedCamera.

    Parameters

    camera*
    Autodesk.Viewing.UnifiedCamera
    the current camera object.
    * Required

    setCameraUpVector(up)

    Set the up direction for the camera. The given vector should be orthogonal to the current view direction.

    Parameters

    up*
    THREE.Vector3
    the new up direction vector
    * Required

    setConstraints2D(viewRegion,maxPixelPerUnit)

    Applies zooming and panning restrictions when viewing 2D models. Invoke without parameters to clear any previous setting.

    Parameters

    viewRegion
    THREE.Box3
    in world space. If specified, navigation is restricted so that this region always spans >= half of the screen extent in x and y.
    maxPixelPerUnit
    Number
    Restrict zoom-In, so that a single unit in world-space never exceeds maxPixelPerUnit on screen.

    setFocalLength(millimeters,adjustPosition)

    Set the current cameras field of view using a 35mm camera focal length value

    Parameters

    millimeters*
    number
    focal length in millimeters
    adjustPosition*
    boolean
    If true, the camera position will be modified to keep either the world space area of the view at the pivot point unchanged (if it is set and visible) or the world space area of view at the camera look at point unchanged.
    * Required

    setIsLocked(state)

    Lock or unlock view modification operations. For a more granular control of locked operations, see setLockSettings.

    Parameters

    state*
    boolean
    when true changes to the current camera parameters are not allowed.
    * Required

    setLockSettings(settings)

    Set the availability of specific camera actions when navigation is locked using setIsLocked.

    Parameters

    settings*
    object
    Map of : pairs specifying whether the given camera action is enabled even when the navigation is locked. The configurable actions are ‘orbit’, ‘pan’, ‘zoom’, ‘roll’, ‘fov’, or ‘gotoview’. By default, none of the camera actions are available when the navigation is locked.
    * Required

    setOrbitPastWorldPoles(state)

    Set or unset a view navigation option to allow the orbit controls to move the camera beyond the north and south poles (world up/down direction). In other words, when set the orbit control will allow the camera to rotate into an upside down orientation. When unset orbit navigation should stop when the camera view direction reaches the up/down direction.

    Not applicable to 2D.

    Parameters

    state*
    boolean
    value of the option, true to allow orbiting past the poles.
    * Required

    setPivotPoint(pivot)

    Sets the Vector3 world space position of the pivot point for orbit navigation.

    Parameters

    pivot*
    THREE.Vector3
    the new pivot position.
    * Required

    setPivotSetFlag(state)

    Set or unset a view navigation option which indicates that the pivot camera parameter is set and can be used for orbit and zoom controls.

    Parameters

    state*
    boolean
    value of the option. When not set orbit and zoom operations should occur at the look at position in the center of the current view.
    * Required

    setPosition(pos)

    Sets the Vector3 world space position of camera.

    Parameters

    pos*
    THREE.Vector3
    the new camera position.
    * Required

    setRequestFitToView(state)

    Issue a request to change the current cameras view position to fit the active model data into the current view frustum.

    Parameters

    state*
    boolean
    value of the requst. Set to true in order to request the change of view.
    * Required

    setRequestHomeView(state)

    Issue a request to change the current cameras view to the current “home” view. The home view includes position, view direction, world up direction and field of view.

    Parameters

    state*
    boolean
    value of the requst. Set to true in order to request the change of view.
    * Required

    setRequestTransition(state,pos,coi,fov,reorient,pivot)

    Issue a request to transition the current cameras view to that specified by the parameters.

    Parameters

    state*
    boolean
    value of the requst. Set to true in order to request the change of view.
    pos*
    THREE.Vector3
    the new camera position in world space
    coi*
    THREE.Vector3
    the point in world space that the camera should look towards.
    fov*
    number
    vertical field of view in degrees
    reorient*
    boolean
    set to true to recalculate up vector
    pivot*
    THREE.Vector3
    the new pivot point
    * Required

    setRequestTransitionWithUp(state,pos,coi,fov,up,worldUp,pivot)

    Issue a request to transition the current cameras view to that specified by the parameters which inlude both the camera up direction and optionally the world up direction.

    Parameters

    state*
    boolean
    value of the requst. Set to true in order to request the change of view.
    pos*
    THREE.Vector3
    the new camera position in world space
    coi*
    THREE.Vector3
    the point in world space that the camera should look towards.
    fov*
    number
    vertical field of view in degrees
    up*
    THREE.Vector3
    use this as the target camera up direction
    worldUp*
    THREE.Vector3
    (optional) use this as the target world up direction
    pivot*
    THREE.Vector3
    the new pivot point
    * Required

    setReverseHorizontalLookDirection(state)

    Set or unset a view navigation option to reverse the default direction for horizontal look operations.

    Not applicable to 2D.

    Parameters

    state*
    boolean
    value of the option, true for reverse, false for default
    * Required

    setReverseVerticalLookDirection(state)

    Set or unset a view navigation option to reverse the default direction for vertical look operations.

    Not applicable to 2D.

    Parameters

    state*
    boolean
    value of the option, true for reverse, false for default
    * Required

    setReverseZoomDirection(state)

    Set or unset a view navigation option to reverse the default direction for camera dolly (zoom) operations.

    Parameters

    state*
    boolean
    value of the option, true for reverse, false for default
    * Required

    setScreenViewport(viewport)

    Set the current canvas viewport in screen coordinates. Invoked internally on canvas resize.

    Parameters

    viewport*
    Object
    Rectangle with properties left, top, width, height.
    * Required

    setTarget(target)

    Sets the Vector3 world space position towards which the camera should be pointing.

    Parameters

    target*
    THREE.Vector3
    the new camera look at point.
    * Required

    setTransitionActive(state)

    Set a status indicating that the current camera view is in a transitioning state. Used internally to indicate that a transition is active.

    Parameters

    state*
    boolean
    value of the transtion status
    * Required

    setUseLeftHandedInput(state)

    Set or unset a view navigation option which requests that mouse buttons be reversed from their default assignment. i.e. Left mouse operation becomes right mouse and vice versa.

    Parameters

    state*
    boolean
    value of the option, true to request reversal of mouse button assignments.
    * Required

    setUsePivotAlways(state)

    Set or unset a view navigation option which requests that orbit controls always orbit around the currently set pivot point.

    Parameters

    state*
    boolean
    value of the option, true to request use of the pivot point. When false some controls may pivot around the center of the view. (Currently applies only to the view-cube orbit controls.)
    * Required

    setVerticalFov(fov,adjustPosition)

    Set the current vertical field of view.

    Parameters

    fov*
    number
    the new field of view in degrees (value is clamped to the minimum and maximum field of view values).
    adjustPosition*
    boolean
    If true, the camera position will be modified to keep either the world space area of the view at the pivot point unchanged (if it is set and visible) or the world space area of view at the camera look at point unchanged.
    * Required

    setView(position,target)

    Sets the cameras position and view direction.

    Parameters

    position*
    THREE.Vector3
    the new position for the camera in world space.
    target*
    THREE.Vector3
    the point in world space that the camera should look towards.
    * Required

    setWorldUpVector(up,reorient)

    Change the current world up direction.

    Parameters

    up*
    THREE.Vector3
    the new world up direction
    reorient*
    boolean
    if true, make sure the camera up is oriented towards the world up direction.
    * Required

    setZoomTowardsPivot(state)

    Set or unset a view navigation option to request the default direction for camera dolly (zoom) operations to be towards the camera pivot point. If unset the default direction would normally be towards the cursor position.

    Parameters

    state*
    boolean
    value of the option, true for towards the pivot, false for default
    * Required

    snapToAxis(v)

    Helper method that snaps a Vector3 to one of the 3 main orthogonal axis.

    Parameters

    v*
    THREE.Vector3
    vector to snap, it gets modified.
    * Required

    toOrthographic()

    Change current camera to orthographic camera

    toPerspective()

    Change current camera to perspective camera.

    Not applicable to 2D.

    updateCamera()

    Update the current camera projection matrix and orient the camera to the current look at point. Invoked internally prior to rendering a new frame with the current camera.

     
    ______
    icon-svg-close-thick

    Cookie preferences

    Your privacy is important to us and so is an optimal experience. To help us customize information and build applications, we collect data about your use of this site.

    May we collect and use your data?

    Learn more about the Third Party Services we use and our Privacy Statement.

    Strictly necessary – required for our site to work and to provide services to you

    These cookies allow us to record your preferences or login information, respond to your requests or fulfill items in your shopping cart.

    Improve your experience – allows us to show you what is relevant to you

    These cookies enable us to provide enhanced functionality and personalization. They may be set by us or by third party providers whose services we use to deliver information and experiences tailored to you. If you do not allow these cookies, some or all of these services may not be available for you.

    Customize your advertising – permits us to offer targeted advertising to you

    These cookies collect data about you based on your activities and interests in order to show you relevant ads and to track effectiveness. By collecting this data, the ads you see will be more tailored to your interests. If you do not allow these cookies, you will experience less targeted advertising.

    icon-svg-close-thick

    THIRD PARTY SERVICES

    Learn more about the Third-Party Services we use in each category, and how we use the data we collect from you online.

    icon-svg-hide-thick

    icon-svg-show-thick

    Strictly necessary – required for our site to work and to provide services to you

    Qualtrics
    W
    Akamai mPulse
    W
    Digital River
    W
    Dynatrace
    W
    Khoros
    W
    Launch Darkly
    W
    New Relic
    W
    Salesforce Live Agent
    W
    Wistia
    W
    Tealium
    W
    Upsellit
    W
    CJ Affiliates
    W
    Commission Factory
    W
    Google Analytics (Strictly Necessary)
    W
    Typepad Stats
    W
    Geo Targetly
    W
    SpeedCurve
    W
    Qualified
    #

    icon-svg-hide-thick

    icon-svg-show-thick

    Improve your experience – allows us to show you what is relevant to you

    Google Optimize
    W
    ClickTale
    W
    OneSignal
    W
    Optimizely
    W
    Amplitude
    W
    Snowplow
    W
    UserVoice
    W
    Clearbit
    #
    YouTube
    #

    icon-svg-hide-thick

    icon-svg-show-thick

    Customize your advertising – permits us to offer targeted advertising to you

    Adobe Analytics
    W
    Google Analytics (Web Analytics)
    W
    AdWords
    W
    Marketo
    W
    Doubleclick
    W
    HubSpot
    W
    Twitter
    W
    Facebook
    W
    LinkedIn
    W
    Yahoo! Japan
    W
    Naver
    W
    Quantcast
    W
    Call Tracking
    W
    Wunderkind
    W
    ADC Media
    W
    AgrantSEM
    W
    Bidtellect
    W
    Bing
    W
    G2Crowd
    W
    NMPI Display
    W
    VK
    W
    Adobe Target
    W
    Google Analytics (Advertising)
    W
    Trendkite
    W
    Hotjar
    W
    6 Sense
    W
    Terminus
    W
    StackAdapt
    W
    The Trade Desk
    W
    RollWorks
    W

    Are you sure you want a less customized experience?

    We can access your data only if you select "yes" for the categories on the previous screen. This lets us tailor our marketing so that it's more relevant for you. You can change your settings at any time by visiting our privacy statement

    Your experience. Your choice.

    We care about your privacy. The data we collect helps us understand how you use our products, what information you might be interested in, and what we can improve to make your engagement with Autodesk more rewarding.

    May we collect and use your data to tailor your experience?

    Explore the benefits of a customized experience by managing your privacy settings for this site or visit our Privacy Statement to learn more about your options.