OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: strike277 on 14 Dec 2007, 00:06:17
-
I'm trying to figure out how to get the camera to follow the terrain like in the intro. How do I animate the sequence between the markers to make this happen?
thanks
-
Something like this?
// Create the camera here and then
_cam camSetPos [getMarkerPos "mk_start" select 0, getMarkerPos "mk_start" select 1, 20];
_cam camSetTarget [getMarkerPos "mk_end" select 0, getMarkerPos "mk_end" select 1, 20];
_cam camCommit 0;
_cam camSetPos [getMarkerPos "mk_end" select 0, getMarkerPos "mk_end" select 1, 20];
_cam camCommit 30;
Sleep 25;
// Destroy camera here
-
useCamera = true
_c = "camera" camCreate getPos mk_start
_cam camSetPos [getMarkerPos "mk_start" select 0, getMarkerPos "mk_start" select 1, 20];
_cam camSetTarget [getMarkerPos "mk_end" select 0, getMarkerPos "mk_end" select 1, 20];
_cam camCommit 0;
_cam camSetPos [getMarkerPos "mk_end" select 0, getMarkerPos "mk_end" select 1, 20];
_cam camCommit 30;
sleep 25;
camDestroy _c
This is the code I tried to use, but it gave me an error with the sleep 25; init. I took it out, got no error, but no camera either. I set up two game logic markers and named one mk_start and the other mk_end.
Sorry, but i'm a newbie at this if ya cant tell.
-
Ok, try this way. Note that the file is init.sqf, not init.SQS. If you need to use SQS instead of SQF, then change the sleep number; by @number
You will need to add two markers, one named mk_start at the origin of the camera movement and the other mk_end at the destination.
// File init.sqf
_time_to_reach_destination = 30;
_camera_height_at_origin = 20;
_camera_height_at_destination = 20;
titleText["", "BLACK FADED"];
_cam = "camera" camcreate [getMarkerPos "mk_start" select 0, getMarkerPos "mk_start" select 1, _camera_height_at_origin];
_cam cameraeffect ["internal", "back"];
_cam camSetTarget [getMarkerPos "mk_end" select 0, getMarkerPos "mk_end" select 1, _camera_height_at_destination];
_cam camSetFov 1.0;
_cam camCommit 0;
_cam camSetPos [getMarkerPos "mk_end" select 0, getMarkerPos "mk_end" select 1, _camera_height_at_destination];
_cam camCommit _time_to_reach_destination;
Sleep 1;
titleText["", "BLACK IN"];
sleep (_time_to_reach_destination)-3;
titleText["", "BLACK OUT"];
Sleep 1;
_cam cameraeffect ["terminate", "back"];
camDestroy _cam;
titleText["", "BLACK IN"];
-
why not just use camera.sqs?
-
Example mission.
-
Thank You Madebol ! I'll give it a try.
**NOTE**
Well Mandebol fixed my problem. Just to let you newbies out there know. If you use an sqf file verse a SQS you will not have to execute the sqf file. Simply place the sqf file in the mission folder and, if the code is correct it will work. Until I downloaded and installed the mission I didn't know this. Makes life very simple.
Madebol thank you very much. You learn something new every day.
MERRY CHRISTMAS every one !
-
BTW, what is a Madebol ????
-
Well Mandebol fixed my problem. Just to let you newbies out there know. If you use an sqf file verse a SQS you will not have to execute the sqf file. Simply place the sqf file in the mission folder and, if the code is correct it will work. Until I downloaded and installed the mission I didn't know this. Makes life very simple.
When a mission starts, it automatically runs init.sqs or init.sqf (depending on which one you have in the folder). This auto-execution is nothing to do with sqs or sqf formatting, but is just a side effect of placing one of these specific two files in your mission folder.