Jump to content
Sign in to follow this  
evans d [16aa]

Circular Panning Shot with "Camers.sqs"

Recommended Posts

Ladies and gentlemen,

I come to you this time with a camera problem.

I'm trying to create a nice smooth video and I have a camera set up with 2 positions. Currently, the camera moves from point A to point B in a straight line. Normally, this would be fine, but does anyone know if there's a way to make the camera pan in a circular fashion around a focal point, ending up at point B, without having to create loads of separate camera waypoints?

intro.sqf

_camera = "camera" camcreate [9445.79,11655.30,0.69]
_camera cameraeffect ["internal", "back"]

;comment "1:19:01";
_camera camPrepareTarget [-59755.55,84578.21,-6627.69];
_camera camPreparePos [9892.10,13131.83,1.49];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 0
@camCommitted _camera

~20

;comment "1:19:41";
_camera camPrepareTarget [93074.07,68228.31,-6627.92];
_camera camPreparePos [9889.10,13132.58,0.72];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 10
@camCommitted _camera

player cameraEffect ["terminate","back"]
camDestroy _camera
exit;

Diagram of my camera path:

http://i.imgur.com/gqj7vh4.png (110 kB)

Point A = Where the camera starts

Point B = Where the camera ends up

Point C = The dotted line is how I would like the camera to move around the unit

Share this post


Link to post
Share on other sites

To sum up: usually, no need for multiple waypoints. Pick an XYZ coordinate to be your target and put it in CamPrepareTarget - it's where you'll be looking at. On the second camera waypoint, use the exact same CamPrepareTarget, deviate a little from the coordinates of CamPrepareTarget and you're set.

So, I saw this thread and it reminded me I was planning to use big camera sequences on a mission I'll start working on.

Went to test it quickly, and it turns out I was surprised with how smoothly the camera was moving -- and it can get way more fine-tuned than that if you spend a few minutes on it.

All I did was section this movement in 10 parts. First, example code you can test on Stratis:

/*init.sqf*/

titlecut [" ","BLACK IN",6];

nul = execVM "intro.sqf";

/*intro.sqf*/

call BIS_FNC_cameraold;

waitUntil {time > 0.1};
showcinemaborder false;

_camera = "camera" camcreate [1934.96,5699.43,3];
_camera cameraeffect ["internal", "back"];

_camera camPrepareTarget [1884,5737,3];
_camera camPreparePos [1934.96,5699.43,3];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 0;

waitUntil {camCommitted _camera;};

_camera camPrepareTarget [1884,5737,3];
_camera camPreparePos [(1934.96)-5,(5699.43)-3.84,3];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 3;

waitUntil {camCommitted _camera;};

_camera camPrepareTarget [1884,5737,3];
_camera camPreparePos [(1934.96)-10,(5699.43)-7.68,3];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 3;

waitUntil {camCommitted _camera;};

_camera camPrepareTarget [1884,5737,3];
_camera camPreparePos [(1934.96)-15,(5699.43)-11.52,3];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 3;

waitUntil {camCommitted _camera;};

_camera camPrepareTarget [1884,5737,3];
_camera camPreparePos [(1934.96)-20,(5699.43)-15.36,3];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 3;

waitUntil {camCommitted _camera;};

_camera camPrepareTarget [1884,5737,3];
_camera camPreparePos [(1934.96)-25,(5699.43)-19.2,3];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 3;

waitUntil {camCommitted _camera;};

_camera camPrepareTarget [1884,5737,3];
_camera camPreparePos [(1934.96)-30,(5699.43)-23.04,3];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 3;

waitUntil {camCommitted _camera;};

_camera camPrepareTarget [1884,5737,3];
_camera camPreparePos [(1934.96)-35,(5699.43)-26.88,3];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 3;

waitUntil {camCommitted _camera;};

_camera camPrepareTarget [1884,5737,3];
_camera camPreparePos [(1934.96)-40,(5699.43)-30.72,3];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 3;

waitUntil {camCommitted _camera;};

_camera camPrepareTarget [1884,5737,3];
_camera camPreparePos [(1934.96)-45,(5699.43)-34.56,3];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 3;

waitUntil {camCommitted _camera;};

_camera camPrepareTarget [1884,5737,3];
_camera camPreparePos [1885.84,5661.61,3];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 3;

waitUntil {camCommitted _camera;};

_camera cameraeffect ["terminate","back"];
camdestroy _camera;

And some illustration of what's happening:

illustration0.jpg

- Point A, the camera starting point, is 100 meters apart from final point B.

- My unit/object is in the middle of this 100 meters segment.

- Red is the elliptical camera path.

- Yellow lines represent each one of the 10 steps until the middle of the path.

- And where the yellow lines converge is where the camera will be looking at, at all times.

For circular panning (mine is elliptical):

For testing purposes, go to the editor and, as guidance, put a simple unit on point A and another one on point B 100 meters apart, with your star unit/object to be "filmed" in between. And the coordinates shown in the editor can be about:

(X,Y)

A (1934.96,5699.43)

B (1835.84,5699.07)

A minus B = roughly (100,0) -- our 100 meters segment. You don't have to be absolutely accurate!

The point at the top of the arc is 50 meters (radius of the circle) distant from the 100 meters imaginary line (diameter) linking unit A and unit B. So, 50 meters in X and 50 meters in Y distant from the starting point, should be the middle of the camera trajectory. You have to divide the movement to this point in some 10 steps:

In (X,Y,Z) coordinates, first, camPreparePos [1934.96,5699.43,3]; -- point A.

Then, camPreparePos [(1934.96)-5,(5699.43)-5,3];

Then, camPreparePos [(1934.96)-10,(5699.43)-10,3];

Then, camPreparePos [(1934.96)-15,(5699.43)-15,3];

And so on...

Until camPreparePos [1885.84,5649.43,3]; -- middle of the arc.

That is, again, roughly equal to camPreparePos [(1934.96)-50,(5699.43)-50,3];

Since camPrepareTarget means to read the coordinates the camera will be looking at, you can use the (X,Y) coordinates of your desired unit, and a height of your choice. In the example I used camPrepareTarget [1884,5737,3];, a bit beyond my unit.

There could be a different way, but this is simple, and requires maybe a couple of minutes.

Edited by rakowozz

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  

×