Jump to content

Sign in to follow this  
ubernoober

Camera.sqs BASICS

Recommended Posts

Can be please someone be so kind and explain me the basics and give some hints where to start working with camera in Arma.

I want to make an engine movie or intro. Sorry if similiar has been asked but i've searched but for total noob as am I found nothing usefull.:hlp:

Really thank you  for reply!!!

Share this post


Link to post
Share on other sites
  (ubernoober @ May 02 2007,10:39) said:
Can be please someone be so kind and explain me the basics and give some hints where to start working with camera in Arma.

I want to make an engine movie or intro. Sorry if similiar has been asked but i've searched but for total noob as am I found nothing usefull.:hlp:

Really thank you  for reply!!!

How much do you know about general scripting? Do you undertand object positions and things like that? Have you written proper scripts before?

If so, I could explain cameras fairly easily for you. biggrin_o.gif

Share this post


Link to post
Share on other sites

Thanks for reply friend,

yes I do know something about scripting but only basics (tried some scripts -mainly based on others work custumized for me) - please write something - every info is useful for me... Dont need something deep. But only few tips how to start work with it, or where to search for knowledge.

Thanks a lot wink_o.gif

Share this post


Link to post
Share on other sites

Well the first thing you need to know is how to create the camera. Every camera needs a starting position, an effect and a target. Example:

You have a soldier called "camviewer", and you want the camera to be created at his position. There is also a tank called "camtarget", and you want the camera to look at it. Code:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_cam = "camera" camCreate (position camviewer)

_cam cameraEffect ["Internal", "Back"]

_cam camSetTarget camtarget

_cam camCommit 0

Explanation:

- _cam is the "name" of the camera. When we want to work with it, we must use the name we defined here.

- "camera" should be obvious.

- camCreate (position viewer) camCreate creates our camera at the position specified.

- cameraEffect ... The camera effect is required and is usually "Internal", "Back". Just make sure you remeber that line whern creating cameras.

- camSetTarget sets the target object or position of our camera, i.e. the way it faces. If the target is a vehicle or soldier, the camera will follow it if it moves.

- camCommit 0 applies the settings we made to the camera. Most settings (like camSetTarget) need the camCommit command before they actually happen. The "0" is the number of seconds this should take. Since we just created our camera, we set the seconds to zero.

You have now created a camera looking from "camviewer" to "camtarget". If you test this, you will find that the camera is placed on the floor, so you might want to change the original position. Perhaps to something like: [(position camviewer select 0),(position camviewer select 1),3]

Moving on...

Now you might want to make your camera look around. You can do this by giving it a new target and then applying the change using camCommit. Example:

We have a second tank called "camtarget2". We want the camera to swerve around and look at it.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_cam camSetTarget camtarget2

_cam camCommit 5

~5

This will make the camera point to the new target. The movement of the camera will take five seconds. I added the "~5" part to stop the script from running while the camera is moving.

Once the camera has pointed at its new target, we want it to wait for 3 seconds and then end, switching back to player view. Deleting a camera is done like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

~3

cameraEffect ["Terminate", "Back"]

camDestroy _cam

The "cameraEffect ["Terminate", "Back"]" bit is required for some reason. The camDestroy command is not enough.

So our script looks like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_cam = "camera" camCreate (position camviewer)

_cam cameraEffect ["Internal", "Back"]

_cam camSetTarget camtarget

_cam camCommit 0

~1

_cam camSetTarget camtarget2

_cam camCommit 5

~5

~3

cameraEffect ["Terminate", "Back"]

camDestroy _cam

These are the basics. I hope you can work from here.  wink_o.gif

Share this post


Link to post
Share on other sites

1000 times THANKS MadDogX!!! for this great little tutorial!

Yes I got the point. Hope i will be able to create something and I am sure this topic will help others too!

Once again thanks! yay.gif

Share this post


Link to post
Share on other sites

Dont forget to use:

camdestroy _camera

_camera cameraeffect ["terminate", "back"]

at the end to terminate the camera.

Share this post


Link to post
Share on other sites
  (Op4 BuhBye @ May 02 2007,15:14) said:
Dont forget to use:

camdestroy _camera

_camera cameraeffect ["terminate", "back"]

at the end to terminate the camera.

I had that in my example.

Share this post


Link to post
Share on other sites

One more time want to thank - i have tested it, i think i got it.

I copied and runned your script it create the camera but it dont want to destroy it. it even write an error (something like ; is missing). Do you know what is wrong?

help.gif

thanks

Share this post


Link to post
Share on other sites
  (ubernoober @ May 03 2007,08:15) said:
One more time want to thank - i have tested it, i think i got it.

I copied and runned your script it create the camera but it dont want to destroy it. it even write an error (something like ; is missing). Do you know what is wrong?

help.gif

thanks

Are you writing .SQS or .SQF scripts?

Share this post


Link to post
Share on other sites

Neither is "wrong" in that sense, but it is better practise to use SQF scripts.

We'll stick to sqs for the moment though, because learning sqf is whole new bag.

As for your error: try switching around the last to statements, so that camDestroy _cam comes before the cameraEffect line.

Share this post


Link to post
Share on other sites

Yope, the differences between sqs and sqf are familiar to me. And thanks for the reply i will try fix the script at home wink_o.gif

Share this post


Link to post
Share on other sites

Is there a way to record a demo without using FRAPS? Like in DOOM 3 where it renders the demo to a file once you've finished recording it?

Share this post


Link to post
Share on other sites

Either you setup a complete cutscene and export it as singleplayer-missionfile that is only viewable in Arma or you go for Fraps or another screenrecorder program. Apart from that there is no function in Arma to support export to video files.

Share this post


Link to post
Share on other sites

As you can see this is my first post so, you guessed it, I'm a noob. Anyway, I followed MadDogX's example leaving out the:

_cam camSetTarget camtarget2

_cam camCommit 5

~5

I only want the camara to follow 1 target so what I have is:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_cam = "camera" camCreate (position camviewer)

_cam cameraEffect ["Internal", "Back"]

_cam camSetTarget camtarget

_cam camCommit 0

~1

~3

cameraEffect ["Terminate", "Back"]

camDestroy _cam

I put that into a text file and named it camera.sqs and placed it in the same folder as my mission. Just as an extra precaution I also created a subfolder called scripts and placed a copy there too.

My problem is the camera faces north and never faces the cobra I have named camtarget.

Share this post


Link to post
Share on other sites

Hi,

Another way to do cutscenes that for me anyway was alot easier to learn is this (Does not get you as good results imo though as maddogx suggestion)

Step by step for anyone to understand smile_o.gif

Please keep in mind alot of this is explained earlier but i am just copying it from where i wrote it else where, hope it helps.  

First go to your mission folder in your documents/mission and open it. Right click and create a notepad doc called init

Open it and type this in player exec "camera.sqs"

Then click save as and where it says "save as type" press down and select "all files" and save the file again as init.sqs

Then load up which ever mission you placed the "init.sqs" in and you should appear as a camera (starting at the player) you move it around and tilt it with the num pad keys.  

When you have found a position you want, left click the mouse. Now alt-tab out and load up init.sqs and select paste(as when you left clicked you saved position to clipboard) under the player exec "camera.sqs" line. Those are the directions for the position you wanted the camera in. Alt-tab again back into the game and choose more positions in the same way.

So your init.sqs should look something like this (note: you can also trigger camera.sqs from units init)

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player exec "camera.sqs"

;===18:11:01

_camera camprepareTarget [-78010.0,-21313.66,127485.56]

_camera camPreparePos [13242.25,8963.63,3.84]

_camera camPrePareFOV 0.700

_camera CamcommitPrepared 0

@camCommited _camera

;===18:09:01

_camera camprepareTarget [-57843.0,-21313.66,127485.56]

_camera camPreparePos [13242.25,8963.63,3.84]

_camera camPrePareFOV 0.700

_camera CamcommitPrepared 0

@camCommited _camera

;===18:07:01

_camera camprepareTarget [-55785.0,-21313.66,127485.56]

_camera camPreparePos [13242.25,8963.63,3.84]

_camera camPrePareFOV 0.700

_camera CamcommitPrepared 0

@camCommited _camera

Now open init.sqs and delete the player exec "camera.sqs" line and replace it with this

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_camera="camera" CamCreate [0,0,0]

_camera cameraeffect ["internal","back"]

This is just us creating the camera with a basic effect

Now we choose how long a camera stays at a certain position and how long before it goes to the next position.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;===18:11:01

_camera camprepareTarget [-78010.0,-21313.66,127485.56]

_camera camPreparePos [13242.25,8963.63,3.84]

_camera camPrePareFOV 0.700

_camera CamcommitPrepared 0

@camCommited _camera

Ok the important lines are

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_camera camPrePareFOV 0.700

This is the field of view of the camera, if say you made it 0.300 the camera would be zoomed in alot more.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_camera CamCommitPrepared 0

This is how long it takes to get to this camera from the previous one, if you want the camera to instantly move to this position keep it at 0. If however you want the camera to move between the last placed camera position and this one in 5 seconds make it 5. 10 for ten seconds ect

Now if you want the camera to wait at the position not moving for a set time you place

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">~5

after

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

@camCommited _camera

5 being the time in seconds before it continues moving to the next position. So this is what it should look like if you want it to wait 8 seconds at this position

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;===18:11:01

_camera camprepareTarget [-78010.0,-21313.66,127485.56]

_camera camPreparePos [13242.25,8963.63,3.84]

_camera camPrePareFOV 0.700

_camera CamcommitPrepared 0

@camCommited _camera

~8

So if you followed all that your init.sqs should look something like this

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_camera="camera" CamCreate [0,0,0]

_camera cameraeffect ["internal","back"]

;===18:11:01

_camera camprepareTarget [-78010.0,-21313.66,127485.56]

_camera camPreparePos [13242.25,8963.63,3.84]

_camera camPrePareFOV 0.700

_camera CamcommitPrepared 0

@camCommited _camera

~6

;===18:09:01

_camera camprepareTarget [-57843.0,-21313.66,127485.56]

_camera camPreparePos [13242.25,8963.63,3.84]

_camera camPrePareFOV 0.700

_camera CamcommitPrepared 8

@camCommited _camera

~1

;===18:07:01

_camera camprepareTarget [-55785.0,-21313.66,127485.56]

_camera camPreparePos [13242.25,8963.63,3.84]

_camera camPrePareFOV 0.700

_camera CamcommitPrepared 4

@camCommited _camera

~1

So this will start at the first position, wait for 6 seconds (~6) then take eight seconds travelling between the first and second position (_camera CamcommitPrepared 8) Then wait there for 1 second. Then take four seconds (_camera CamcommitPrepared 4) to reach the last position which it waits at for 1 second.

To end the cutsceen and go back into been able to use the player put this at the end

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_camera cameraeffect ["terminate","back"]

Camdestroy _camera

Also you don't need to run this in the init.sqs, you can call it whatever you want and launch it after a trigger or waypoint or whatever just put <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[] exec "namehere.sqs"in the units init  smile_o.gif

You can also lock targets with the E key i think it was.

If there is anything wrong with any of this, please anyone feel free to help me out as well because i'm just trying to grasp the basics of this.

Share this post


Link to post
Share on other sites

Sorry guys but another total noob here looking for some help.

I have this in my camera.sqs

_cam = "camera" camCreate (position camviewer)

_cam cameraEffect ["Internal", "Back"]

_cam camSetTarget camtarget1

_cam camCommit 0

~10

cameraEffect ["Terminate", "Back"]

camDestroy _cam

What I'm trying to do is create a win outro scene with a camera on the ground that follows a chopper as it fly's by.

My chopper is named "target1" and I've placed a trigger called "camviewer" nearby with camviewer exec "camera.sqs" in the init line.

So I can test things in the editor I had to place another soldier (me) but all I get is a rear view of my character.

How do I get the script to run?

Any help for an old gamer greatly appreciated. (well not that old but no spring chicken)

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  

×