Welcome, Guest Wednesday 23rd April 2014, 22:21:54
   Home   Help Search Login Register  

OFPEC Forum

Author Topic: Attach a camera to a vehicle  (Read 729 times)
0 Members and 1 Guest are viewing this topic.
thelittlegreenman
*
Offline Offline


« on: 02 Apr 2007, 09:32:52 »

I was wondering where I could get a script to attach a camera to a vehicle. Preferably so that the camera is not orientated around the center of the vehicle. I searched the forums and did not find a script that worked/ I could work. I need step by step instructions  Wink .
Logged
Cheetah
Missions Depot Staff
*****
Offline Offline



« Reply #1 on: 02 Apr 2007, 09:37:21 »

Attaching is pretty easy, but how do you want it orientated?
Logged

Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!
thelittlegreenman
*
Offline Offline


« Reply #2 on: 02 Apr 2007, 09:40:24 »

An example shot would be to have the camera attached to a jeep with just showing the front grill plate. Maybe a centre axis could work.
Logged
bedges
Administrator
*****
Offline Offline


WWW
« Reply #3 on: 02 Apr 2007, 10:47:14 »

investigate blanco's logiccam script. it was written for ofp, and as far as i know hasn't been tested for compatibility with arma. it does exactly what you're describing though, and with a little tinkering should work fine.
Logged
thelittlegreenman
*
Offline Offline


« Reply #4 on: 02 Apr 2007, 11:56:57 »

i read in another thread Blanco had trouble converting the logiccam script. I then looked at this thread:

http://www.ofpec.com/forum/index.php?topic=28949.msg197281#msg197281

and found some things that work. For example, this:

Code:
_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"

works, but I am unsure of how to control the amount of time the camera is staying place. It seems to stick the vehicle for roughly 5 seconds before becoming 'unlocked'.
Logged
hoz
OFPEC Site
Administrator
*****
Offline Offline



« Reply #5 on: 02 Apr 2007, 15:39:26 »

Its the ~0.01 that is refreshing the camera. This is telling the script to hold the loop for a split second and then update.

the line 
Code:
?(_i == 300): goto "exit";
is what is preventing it from being unlocked. What you can do here is once the unit arrives at the WP you could make some variable true like arrival=true
then change the line to read like this...


Code:
?arrival: goto "exit";

Logged

Xbox Rocks
Cheetah
Missions Depot Staff
*****
Offline Offline



« Reply #6 on: 02 Apr 2007, 19:19:01 »

I do have to note that it's not working the way you would expect it to work, at least not in this sqs syntax. With it's current settings you'd expect the camera to stay attached for 300 x 0.01 = 3 seconds. But, as in sqs syntax the ~time doesn't have a priority, it is likely to be more than 0.01 seconds. Let's say 0.03 or any other limit for the SQS syntax that causes the script to run more than three let's say five seconds.

You'd probably get the same result by using ~0.1 instead of ~0.01. Untested though, if the ~time value is high enough (for example ~0.1) you can adjust the _i maximum value (in the example 300) to your desired timeout. Make sure that the refresh time (~0.1) is low enough, 0.1 might actually be too high and could cause a shaky camera. Clear?
Logged

Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!
bedges
Administrator
*****
Offline Offline


WWW
« Reply #7 on: 02 Apr 2007, 20:59:11 »

an alternative would be to use the reserved _time variable, thus:

Code:
_limit = _time
#loop
_camera camPrepareTarget blabla;
_camera camPrepareRelPos [0,-7,2];
_camera camPrepareFOV 0.700
_camera camCommitPrepared 0
~0.01
?not (_time >= (_limit + however many seconds you want it to last for)): goto "loop";

in this case the ~0.01 is merely used to stop the loop from repeating too fast and sucking up resources. it's the _time comparison which dictates how long it runs for.
Logged
Mandoble
Editors Depot
Administrator
*****
Offline Offline



WWW
« Reply #8 on: 02 Apr 2007, 21:22:45 »

Beware with _time, last time I checked it in OFP it was reset each time you load a game (If I remember well).

EDIT: it is time, not _time what I'm talking about, no idea what is _time.
« Last Edit: 02 Apr 2007, 22:16:35 by Mandoble » Logged

Planck
Honoured
Former Staff
****
Offline Offline


I'm never wrong ....I'm just not always right !


« Reply #9 on: 03 Apr 2007, 01:16:23 »

_time is a reserved variable and it holds the time elapsed since a script started.   Yes


Planck
Logged

I know a little about a lot, and a lot about a little.
bedges
Administrator
*****
Offline Offline


WWW
« Reply #10 on: 03 Apr 2007, 08:01:56 »

indeed, nevertheless mandoble's warning is apt in some very rare cases that a game just happens to be saved when a script is mid-way through a loop which relies on a _time comparison. only experimentation would reveal if the value of _time is saved along with the script state.
Logged
SaBrE
*
Offline Offline

I was once a Llama


WWW
« Reply #11 on: 03 Apr 2007, 11:07:32 »

Bit off-topic but whereabouts of OFPEC can I find a list of all reserved variables?
Logged

Can you HELP?
Cheetah
Missions Depot Staff
*****
Offline Offline



« Reply #12 on: 03 Apr 2007, 11:14:38 »

Found a topic about reserved variables and sometimes it's good to know which variables are usable. A few days ago I had trouble with a civilian named - civilian.
Logged

Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!
SaBrE
*
Offline Offline

I was once a Llama


WWW
« Reply #13 on: 03 Apr 2007, 12:02:35 »

Looks good, thanks Good
Logged

Can you HELP?
Mandoble
Editors Depot
Administrator
*****
Offline Offline



WWW
« Reply #14 on: 03 Apr 2007, 14:39:49 »

Two confirmed facts in ArmA:
1 - _time is available only for sqs scripts, not for sqf.
2 - time is still reset to 0 after loading any previously saved game (this is quite stupid and disturbing  Blink).


EDIT:
The safe way to do it in sqf (or sqs) is the following:
Code:
_timeini = daytime * 3600;
// 30 seconds to wait for something
_waittime = 30;
while {(daytime * 3600) < (_timeini + _waittime)} do
{
.....
};

Code:
_timeini = daytime * 3600
_waittime = 30
#loop
_camera camPrepareTarget blabla;
_camera camPrepareRelPos [0,-7,2];
_camera camPrepareFOV 0.700
_camera camCommitPrepared 0
~0.01
?((daytime * 3600) < (_timeini + _waittime)): goto "loop";

daytime is correct all the time, even after loading a game.
Logged

Pages: [1]   Go Up
  Send this topicPrint  
 
Jump to: