{"name":"camPreload","title":"camPreload","type":"command","url":"https://community.bistudio.com/wiki/camPreload","revid":369112,"updated":"2024-09-03T10:28:47Z","groups":["Camera Control"],"status":"ok","games":{"arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma1 1.00","arma3_since":"0.50","description":"Preloads the scene for the prepared camera with given timeout after which preloading is aborted. Max timeout is 30 seconds. Timeout of 0 means max timeout of 30 seconds as well.\n\n> [!NOTE]\n> This command will read prepared params set with camPrepareFOV, camPreparePos and camPrepareTarget, so no camCommitPrepared is necessary. If camPrepareFOV is not set, the default value is 1. If camPrepareTarget (for direction) and camPreparePos (for position) are not set, current direction and position of the camera are used. The prepared camera preload will preload main camera as well. cameraEffect is not necessary","syntaxes":[{"syntax":"camera camPreload timeout","params":[{"name":"camera","type":"Object","type_expr":"Object"},{"name":"timeout","type":"Number","type_expr":"Number"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"camera"},"right":{"text":"timeout"}}],"examples":[{"code":["_camera camPreload 5;"]},{"text":"Preload camera around player to avoid stuttering on optics zooming:\n\n```sqf\n0 spawn\n{\n    _cam = \"camera\" camCreate (player selectionPosition \"camera\");\n    for \"_i\" from 0 to 359 do\n    {\n        _cam setDir _i;\n        _cam camPrepareFov 0.25;\n        _cam camPreload 0;\n        waitUntil { camPreloaded _cam };\n    };\n    camDestroy _cam;\n};\n```","code":["0 spawn \n{\n\t_cam = \"camera\" camCreate (player selectionPosition \"camera\");\n\tfor \"_i\" from 0 to 359 do\n\t{\n\t\t_cam setDir _i;\n\t\t_cam camPrepareFov 0.25;\n\t\t_cam camPreload 0;\n\t\twaitUntil { camPreloaded _cam };\n\t};\n\tcamDestroy _cam;\n};"]}],"see_also":["camPreloaded","preloadCamera"]}