Setting 3D View Camera by Script

It is possible to set the view of FRED's 3D View in a script. This is done using the T_CAMERA structure. Below is a very simple example that sets the view to be one aimed at the global origin, from a camera position of Y = 50, Z = 50, and with the camera's Y axis the same as the global Y axis.

    Dim cam As T_CAMERA

    'aim of camera
    'example: global origin
    cam.xAim = 0
    cam.yAim = 0
    cam.zAim = 0

    'location of camera
    'example; at (0,50,50)
    cam.xLoc = 0
    cam.yLoc = 50
    cam.zLoc = 50

    'orientation of camera
    'example: camera orientation is same as global
    cam.xUp = 0
    cam.yUp = 1
    cam.zUp = 0

    SetCamera cam

Still need help? Contact Us Contact Us