Jump to content
Sign in to follow this  
Melmarkian

Camera to follow a plane correctly

Recommended Posts

Hi,

I have started making a few missions (maybe campaign) and want to add an intro for the first one. There is one scene where the camera follows a plane for a short time but the camera always stutters when it tries to follow it.

This is the camera config i´m using.

#Loop

_camera camsettarget badplane1
_camera camsetrelpos [-7,-40,10]
_camera camPrepareFOV 0.700
_camera camCommit 0
;@camCommitted _camera 
? camtrig3 = true : goto "Tower"

goto "Loop"

I tried a few different angles but camera doesn´t seem fast enough to follow the plane correctly.

I´m adding the mission where it happens (done with the great Camp Fortress Template from Ei8ght :) ).

You can see it in action when you run the preview in the intro.

Mission:

http://www.mediafire.com/?vzovx093liz6b6o

Hopefully i removed all addons. Sorry if you can´t open it.

Share this post


Link to post
Share on other sites

maybe its because sqs is not as efficient as sqf? try this and save it in sqf format, eg mycamerascript.sqf

This will run the camera loop until camtrig3 is true, then it will exit and continue below.

Note i did only copy and paste your own camera lines so i did not check the validness of them all.

while {!camtrig3} do {
  _camera camsettarget badplane1;
  _camera camsetrelpos [-7,-40,10];
  _camera camPrepareFOV 0.700;
  _camera camCommit 0;
  //@camCommitted _camera;
  waitUntil {camCommitted _camera};
};

I could not for the life of me remember what the @ in @camCommitted _camera; means.

I see you have comented it out in your script in sqs, same is done with using // instead of ; in sqf.

Edit: maybe @ is waituntil wich seems logical here:

then line should be:

waitUntil {camCommitted _camera};

another way may be to use the attachTo command on the camera and simply attach it to the plane so then it will run smoothly.

Edited by Demonized

Share this post


Link to post
Share on other sites

Thanks again.

It works better with sqf. It just takes some time to change the syntax because the camera always safes sqs lines.

Share this post


Link to post
Share on other sites

while {!camtrig3} do {
  _camera camsettarget badplane1;
  _camera camsetrelpos [-7,-40,10];
  _camera camPrepareFOV 0.700;
  _camera camCommit 0;
  waitUntil {camCommitted _camera};
};

Having a bit of trouble with this loop.

Is {!camtrig3} a trigger? How do you set it up?

I have placed a trigger called camtrig3 but the script fails at this loop?

If I change it to {true} it works?

Share this post


Link to post
Share on other sites
Having a bit of trouble with this loop.

Is {!camtrig3} a trigger? How do you set it up?

I have placed a trigger called camtrig3 but the script fails at this loop?

If I change it to {true} it works?

!camtrig3 was just a variable from Melmarkian OP, so it is checking for camtrig3=false

wich !camtrig3 is true to.

OP probably have a trigger wich sets camtrig3 to false when plane reach a destination so he can change camera or do something else.

Share this post


Link to post
Share on other sites
I'm not sure....why do you recommend it?

Eheh, well:

while {!camtrig3} do {
  _camera camsettarget badplane1;
  _camera camsetrelpos [-7,-40,10];
  _camera camPrepareFOV 0.700;
  _camera camCommit 0;
  waitUntil {camCommitted _camera};
};

Would become:

_camera camsettarget badplane1;
_camera camPrepareFOV 0.700; 
_camera attachTo [badPlane1, [-7,-40,10]];
waituntil { _someCondition };
detach _camera;

Bellow example is a far better solution in this case.

;)

_neo_

Share this post


Link to post
Share on other sites

Thanks Neo - it is a good alternative!

I came up with this that worked well:

_pos = getPos land1;
_cam camsettarget h1;
_cam camPrepareFOV 0.700;
_cam attachTo [h1, [10,50,10]];
_cam setDir 180;
waituntil { h1 distance _pos <= 100 };
detach _cam;

I had to use the setDir to get it to look back at the helicopter. Also it's stuck in 1 plane and does not track the target and the camera tilts with the helicopter when it banks.

This does not happen with the setRelPos method. It's an effect that might not be desirable but I found that when attachTo is combined with setRelPos scenes it makes a good dynamic movie!

Share this post


Link to post
Share on other sites

Is there a way to set up an incremental variable? x=0 in the start of the script, x=x+1 each time it loops, ? x=60 : goto "nextscene"?

I see the attachTo being handy too but what if I want a ground based camera to pan and follow a moving heli or something?

Share this post


Link to post
Share on other sites
_timer = 0;

while {_timer != 60} do {
  <code>
  _timer = _timer + 1;
  sleep 1;
};
// will reach here after 60 seconds (when _timer is 60)

Share this post


Link to post
Share on other sites
_timer = 0;

while {_timer != 60} do {
  <code>
  _timer = _timer + 1;
  sleep 1;
};
// will reach here after 60 seconds (when _timer is 60)

Thanks! I'll give that a whirl!

Does it have to be "_timer" specifically or could you use any variable?

Can it be used in the code block itself, for example in:

_camera camsetrelpos [-7,-40,_timer];

to provide a sort of zoom out effect? Or a pan?

Is there a manual or tutorial or something I should be reading?

Thanks again!

Share this post


Link to post
Share on other sites

i think mr murrays editing guide deluxe have a extensive part on cameras.

and yes, _timer can be anything as long as it = a number, fex:

_how_long_i_take_to_poo = 0;
;)

you can also use true or false conditions instead of numbers but then fancy scripting somewhere else is needed.

fex have oneCam = true; in init.sqf

while {oneCam} do {
  <code>
  // this will repeat as long as onecam is true.
};

have a trigger with oneCam = false and vehicle present or something, and once it fires while loop ends.

Edited by Demonized

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×