Camera API

editor.selectCamera(type)
Parameters:type

the camera type. Allowed values:

  • editor.CameraType_Game - the gameplay camera
  • editor.CameraType_Fly - the editor fly-by camera
  • editor.CameraType_Orbit - orbit camera around the current selection

Sets the current camera in the editor’s viewport.

editor.toggleFlyCamera()

Toggles between current in-game camera and fly (editor) camera.

editor.placeCameraAtSelection()

Sets the camera position at the center of the current object selection.

editor.placeCameraAtPlayer()

Sets the camera position at the current player position.

editor.placePlayerAtCamera()

Sets the player position at the current editor camera position.

editor.getCamera()
Returns:the current editor camera
editor.fitViewToSelection()

Fit/position the camera viewport to the bounding box of the selected objects, so one can view the entire selection.

editor.fitViewToSelectionAndOrbit()

Fit/position the camera viewport to the bounding box of the selected objects, so one can view the entire selection. At the same time, enable orbit camera around the selection.

editor.setCameraSpeed(speed)
Parameters:speed

the speed of the fly camera movement. Allowed values:

  • editor.CameraSpeed_Slowest
  • editor.CameraSpeed_Slow
  • editor.CameraSpeed_Slower
  • editor.CameraSpeed_Normal
  • editor.CameraSpeed_Faster
  • editor.CameraSpeed_Fast
  • editor.CameraSpeed_Fastest

Sets the speed of the editor fly camera.

editor.setCameraProjection(projectionType)
Parameters:projectionType

the type of camera projection. Allowed values:

  • editor.CameraProjection_Top
  • editor.CameraProjection_Left
  • editor.CameraProjection_Front
  • editor.CameraProjection_Perspective

Sets camera projection type.

editor.addCameraBookmark(name)
Parameters:name – the name of the bookmark

Adds a new named camera bookmark at the current world position.

editor.deleteCameraBookmark(name)
Parameters:name – the name of the bookmark

Deletes a camera bookmark by its name.

editor.getCameraBookmarks()
Returns:the bookmarks table, the keys are the names of the bookmarks and the values are tables with the following fields:
  • name - the name of the bookmark
  • time - the time the bookmark was created
  • username - the username who created the bookmark
  • location - the Point3F of the bookmark camera location
editor.clearCameraBookmarks()

Delete all the camera bookmarks.

editor.jumpToCameraBookmark(name)
Parameters:name – the name of the bookmark to jump to

Jump to the named camera bookmark.

editor.setupDefaultCameraSettings()

[Deprecated]