SetEngineCameraPosition

Definition

SetEngineCameraPosition(string engineCameraName, float x, float y, float z)

Description

This function sets the position of the engine camera engineCameraName.

Parameters

engineCameraName
Specifies the name of the engine camera. You can also use the name “this” for this parameter. In this case, “this” refers to the camera object that this script is attached to.

x, y, z
Specify the X, Y and Z components of engine camera position.

Example 1

function Init()
    ActivateEngineCamera("camera1")
    SetEngineCameraPosition("camera1", 2.5, 5.0, 7.0)
end

function Update()

end
First we activate the engine camera “camera1”. Then we set the position of engine camera “camera1” to (2.5, 5.0, 7.0).

Example 2

--Name of script is SetEngineCameraPosition2.lua

function Init()
    ActivateEngineCamera("this")
    SetEngineCameraPosition("this", 2.5, 5.0, 7.0)
end

function Update()

end
In this case, “this” string in the SetEngineCameraPosition function points to the camera that SetEngineCameraPosition2.lua script is attached to. For example, if SetEngineCameraPosition2.lua script is attached to a engine camera named “camera1”, “this” will be equivalent to the name “camera1”.
In this example, we activate the current engine camera (for example, “camera1”). Then we set the position of current engine camera to (2.5, 5.0, 7.0).
adminSetEngineCameraPosition