OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Brandon on 14 Mar 2007, 18:46:49

Title: Camera: Following a jet? Can this be done with camera sqs?
Post by: Brandon on 14 Mar 2007, 18:46:49
Other than setting 2 destinations for 2 cameras and just speeding up the time one camera moves to another.. is there a way to make a camera slowly start to zoom into an aircraft while following it at 1000kmh? Holding shift in camera.sqs is not fast enough  :blink:

Sorry if I'm not as knowledgeable as I should be. I've owned OFP for 5+ years and still face problems with even the basics.
Title: Re: Camera: Following a jet? Can this be done with camera sqs?
Post by: D_P_ on 14 Mar 2007, 22:28:59
Dunno if you checked this old ofp script out (vehicle cam) - may give you a push in the right direction :)
Title: Re: Camera: Following a jet? Can this be done with camera sqs?
Post by: Cheetah on 14 Mar 2007, 23:23:19
That script would work fine, if you don't like reading it (with all the text and stuff that isn't really needed) you can use the following.

Code: [Select]
_i = 0;
#loop
_camera camPrepareTarget blabla;
_camera camPrepareRelPos [0,-7,2];
_camera camPrepareFOV 0.700
_camera camCommitPrepared 0
~0.01
?(_i == 300): goto "exit";
_i = _i + 1;
goto "loop"

You can copy and paste this into your fileName.sqs script with all the camera positions. Important things are that "blabla" is the name of the jet you want to follow. The RelPos might not fit your needs, you might want to play a bit with the numbers between the brackets (x,y,z).

Also note that there are many ways to stop the loop, I incorporated a counter might as well have checked for a variable to turn true (activated outside the script).
Title: Re: Camera: Following a jet? Can this be done with camera sqs?
Post by: Blanco on 15 Mar 2007, 19:49:50
Quote
is there a way to make a camera slowly start to zoom into an aircraft while following it at 1000kmh?

Thats a hard one...
Vehiclecam follows the center of the object from a relative distance but you can't zoom in or out.
I have made a logiccam for OFP, it's similar to vehiclecam, but with logiccam you can film any part of the vehicle while it's moving. For example a closeup scene from a headlight while the vehicle is moving, but you can't zoom in or out.

It's still in the editor depot but it only works with OFP
http://www.ofpec.com/ed_depot/the_files/OFPResources/scripts/logiccam.zip

I tried to convert it for Arma but I failed.   :(

There is a new camera command for the fov
http://community.bistudio.com/wiki/camPrepareFovRange

Also the switchcamera command can be usefull
http://community.bistudio.com/wiki/switchCamera
 



Title: Re: Camera: Following a jet? Can this be done with camera sqs?
Post by: h- on 15 Mar 2007, 20:21:22
And again, the commands are also available in our COMREF  :shhh:

camPrepareFovRange (http://www.ofpec.com/COMREF/ArmAOnly/index.php?action=list&game=All&letter=c#camPrepareFovRange)
switchCamera (http://www.ofpec.com/COMREF/OFP/index.php?action=list&game=All&letter=s#switchCamera)
Title: Re: Camera: Following a jet? Can this be done with camera sqs?
Post by: Blanco on 15 Mar 2007, 20:28:58
ok, ok I will direct them to our comref next time.
Title: Re: Camera: Following a jet? Can this be done with camera sqs?
Post by: h- on 15 Mar 2007, 21:27:41
 :yes:

I just see no point in directing people out from here when the same stuff is here already... 
Title: Re: Camera: Following a jet? Can this be done with camera sqs?
Post by: Cheetah on 15 Mar 2007, 23:17:09
Code: [Select]
_i = 0;
_zoom = 0.700;
#loop
_camera camPrepareTarget blabla;
_camera camPrepareRelPos [0,-7,2];
_camera camPrepareFOV _zoom;
_camera camCommitPrepared 0
~0.01
?(_i == 300): goto "exit";
_i = _i + 1;
_zoom = _zoom - 0.01;
goto "loop"

Something like this? You might have to play with the number, don't know if it works.
Title: Re: Camera: Following a jet? Can this be done with camera sqs?
Post by: Blanco on 16 Mar 2007, 04:03:12
Yes thats works.  :) I tried similar stuff in OFP and it never worked.

I tried to create a script from your code:

Params
1-- camera ID
2-- Camrelpos array
3-- Target to film
4-- Zoomfactor when the scene starts
5-- Zoomfactor when the scene ends

Full example (run it in your camerascript)
[_camera,[10,0,2],myjeep,0.7,0.2] exec "script.sqs"

Quote
_cam = _this select 0
_target = _this select 1
_camrelpos = _this select 2
_startzoom = _this select 3
_endzoom = _this select 4
@!(VEHZOOM_ON)
VEHZOOM_ON = true

_xpos = _Camrelpos select 0
_ypos = _Camrelpos select 1
_zpos = _Camrelpos select 2

Cuttext ["","BLACK IN",1]

#scene
_cam camPrepareTarget _target;
_cam camPrepareRelPos [_xpos,_ypos,_zpos];
_cam camPrepareFOV _startzoom;
_cam camCommitPrepared 0
~0.001
_startzoom = _startzoom - 0.001;
?_startzoom < _endzoom : VEHZOOM_ON = false;goto "done"
goto "scene"

#done

~0.2
exit


It works but it's hard to control the duration of the scene.
It's far from perfect but it's a start  ;) It would be better in sqf, but I'm not there yet.

Check the example in the attachment