OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: swtx on 15 May 2007, 05:10:47

Title: Camera scripting problem
Post by: swtx on 15 May 2007, 05:10:47
I'm trying to mount a fixed camera to an A10, but I'm having trouble.

I'm using this code:

Code: [Select]

;--Vehicle-cam----------------------------------------------------------

vehiclecamstop = false
#loop

_cam = "camera" camcreate [0,0,0]

_cam cameraeffect ["internal", "front"]

_cam camsettarget A10

_cam camsetrelpos [0, 5, 10]

#commit
_cam camcommit 0


_cam camsettarget A10
_cam camcommit 0

~0.01

? NOT(vehiclecamstop) : goto "loop" 


_cam cameraeffect ["terminate", "back"]
camdestroy _cam


Everytime I execute the script I get a pretty shot of the ocean.

Is there anyway I can fix this ?
Title: Re: Camera scripting problem
Post by: D_P_ on 15 May 2007, 07:53:34
Code: [Select]
_cam camsettarget A10
i believe you see the pretty ocean because Arma is looking for an object called A10 and can't find it...try renaming the jet. (or chaning the script to reflect the aircrafts NAME/not what kind it is.)

Also this is a must read for cutscene makers:
http://www.ofpec.com/forum/index.php?topic=28923.0
Title: Re: Camera scripting problem
Post by: Mandoble on 15 May 2007, 10:09:05
Create the camera before your loop starts, not inside your loop.
Title: Re: Camera scripting problem
Post by: IGWedge on 24 May 2007, 20:16:06
Hi

How can i camera follow vehicle script to SQF format??

I am still not grasping the transition from goto "loop" ..... into SQF

can someone explain or point me in the right direction.

PS i have read through Cheetas Basic SQS tut

thanks
Title: Re: Camera scripting problem
Post by: Mandoble on 24 May 2007, 20:35:05
Something quite basic to start with:

Code: [Select]
//followplane.sqf
_plane = _this select 0;
keepfollowing = true;
_cam = "camera" camcreate [0, 0, 0];
_cam cameraeffect ["internal", "back"];
_relpos = [-25, 10, 5];
_cam camSetRelPos _relpos;
_cam camSetTarget _plane;
_cam camSetFov 1;
_cam camCommit 0;
while {keepfollowing} do
{
   _cam camSetRelPos relpos;
   _cam camCommit 0.2;
   Sleep 0.01;
};
_cam cameraeffect ["terminate", "back"];
camDestroy _cam;

To execute:
Code: [Select]
res=[myplane]execVM"followplane.sqf"
Note that you may set global variable keepfollowing to true in case you want to stop the script.
Title: Re: Camera scripting problem
Post by: IGWedge on 24 May 2007, 20:42:58
Thats excellent mate thanks

I can learn from what you have showed me

Cheers

wedge :D
Title: Re: Camera scripting problem
Post by: swtx on 26 May 2007, 10:03:50
Thanks for your help gents, problem solved  :good: