ActivateImportedCameraOfPrefabInstance 

Definition

ActivateImportedCameraOfPrefabInstance(string prefabInstanceName, string prefabCameraName, float endTime[optional])

Description

Imported cameras are cameras that are imported to vanda engine through a 3D software in COLLADA format. To view the imported cameras of prefab instances, open the VScene and click on the desired Prefab Instance in the “Prefabs and GUIs” section and press the Edit button. You can also access the imported camera names of prefab instances from the Script Utility section of the script editor ( Tools > Script Editor > Tools > Script Utility). In the dialog that appears, you can view and copy the name of the prefab instance and its imported camera – if any.
These cameras are not enabled by default. This function allows you to activate the imported camera of prefab instance.

Parameters

prefabInstanceName
Specifies the name of the prefab instance. You can also use the name “this” for this parameter. In this case, “this” refers to the prefab instance that this script is attached to.

prefabCameraName
Specifies the name of the prefab camera.

endTime
By default, ActivateImportedCameraOfPrefabInstance function activates the imported camera indefinitely. This parameter allows you to activate the imported camera for endTime. After endTime, the third-person or first-person physics camera is activated. This parameter is optional and must be equal to or greater than 0.0.

Example 1

function Init()
     ActivateImportedCameraOfPrefabInstance("1_VandaEngine17-SamplePack1_v3_house7""Camera-camera", 5.0)
end

function Update()

end
In this case, the ActivateImportedCameraOfPrefabInstance function activates the imported camera “Camera-camera” of the prefab instance “1_VandaEngine17-SamplePack1_v3_house7” – if it exists – for 5.0 seconds. After 5.0 seconds, the first person or third person physics camera will be activated.

Example 2

--Script name is prefabInstanceCamera.lua

function Init()
     ActivateImportedCameraOfPrefabInstance("this""Camera-camera")
end

function Update()

end
If, in the Prefab Editor, you attach prefabInstanceCamera.lua script to a Prefab that has an imported “Camera-camera”, the “this” parameter in the ActivateImportedCameraOfPrefabInstance function will point to instances of that Prefab in current VScene. For example, if you have an Instance named instance1_a from a Prefab named to which this script is attached, “this” in ActivateImportedCameraOfPrefabInstance function refers to the name instance1_a.
In this case, ActivateImportedCameraOfPrefabInstance function activates the “Camera-camera” of Prefab Instance named instance1_a – if it exists – indefinitely.
adminActivateImportedCameraOfPrefabInstance