Home   Help Search Login Register  

Author Topic: Camera Following terrain?  (Read 1680 times)

0 Members and 1 Guest are viewing this topic.

Offline strike277

  • Members
  • *
  • C.O. Of =Task Force Knight~Wing=
Camera Following terrain?
« on: 14 Dec 2007, 00:06:17 »
I'm trying to figure out how to get the camera to follow the terrain like in the intro. How do I animate the sequence between the markers to make this happen?

thanks

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Camera Following terrain?
« Reply #1 on: 14 Dec 2007, 13:43:25 »
Something like this?

Code: [Select]
// Create the camera here and then

_cam camSetPos [getMarkerPos "mk_start" select 0, getMarkerPos "mk_start" select 1, 20];
_cam camSetTarget [getMarkerPos "mk_end" select 0, getMarkerPos "mk_end" select 1, 20];
_cam camCommit 0;
_cam camSetPos [getMarkerPos "mk_end" select 0, getMarkerPos "mk_end" select 1, 20];
_cam camCommit 30;
Sleep 25;

// Destroy camera here

Offline strike277

  • Members
  • *
  • C.O. Of =Task Force Knight~Wing=
Re: Camera Following terrain?
« Reply #2 on: 14 Dec 2007, 14:22:19 »
useCamera = true
_c = "camera" camCreate getPos mk_start

_cam camSetPos [getMarkerPos "mk_start" select 0, getMarkerPos "mk_start" select 1, 20];
_cam camSetTarget [getMarkerPos "mk_end" select 0, getMarkerPos "mk_end" select 1, 20];
_cam camCommit 0;
_cam camSetPos [getMarkerPos "mk_end" select 0, getMarkerPos "mk_end" select 1, 20];
_cam camCommit 30;
sleep 25;

camDestroy _c

This is the code I tried to use, but it gave me an error with the sleep 25; init. I took it out, got no error, but no camera either. I set up two game logic markers and named one mk_start and the other mk_end.

Sorry, but i'm a newbie at this if ya cant tell.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Camera Following terrain?
« Reply #3 on: 14 Dec 2007, 17:33:19 »
Ok, try this way. Note that the file is init.sqf, not init.SQS. If you need to use SQS instead of SQF, then change the sleep number; by @number

You will need to add two markers, one named mk_start at the origin of the camera movement and the other mk_end at the destination.

Code: [Select]
// File init.sqf
_time_to_reach_destination = 30;
_camera_height_at_origin = 20;
_camera_height_at_destination = 20;

titleText["", "BLACK FADED"];
_cam = "camera" camcreate [getMarkerPos "mk_start" select 0, getMarkerPos "mk_start" select 1, _camera_height_at_origin];
_cam cameraeffect ["internal", "back"];
_cam camSetTarget [getMarkerPos "mk_end" select 0, getMarkerPos "mk_end" select 1, _camera_height_at_destination];
_cam camSetFov 1.0;
_cam camCommit 0;
_cam camSetPos [getMarkerPos "mk_end" select 0, getMarkerPos "mk_end" select 1, _camera_height_at_destination];
_cam camCommit _time_to_reach_destination;
Sleep 1;
titleText["", "BLACK IN"];
sleep (_time_to_reach_destination)-3;
titleText["", "BLACK OUT"];
Sleep 1;
_cam cameraeffect ["terminate", "back"];
camDestroy _cam;
titleText["", "BLACK IN"];

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: Camera Following terrain?
« Reply #4 on: 14 Dec 2007, 19:50:16 »
why not just use camera.sqs?
Campaigns are hard, I'll stick with scripting for now!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Camera Following terrain?
« Reply #5 on: 25 Dec 2007, 00:45:11 »
Example mission.

Offline strike277

  • Members
  • *
  • C.O. Of =Task Force Knight~Wing=
Re: Camera Following terrain?
« Reply #6 on: 25 Dec 2007, 08:44:51 »
Thank You Madebol ! I'll give it a try.

**NOTE**

Well Mandebol fixed my problem. Just to let you newbies out there know. If you use an sqf file verse a SQS you will not have to execute the sqf file. Simply place the sqf file in the mission folder and, if the code is correct it will work. Until I downloaded and installed the mission I didn't know this. Makes life very simple.

Madebol thank you very much. You learn something new every day.

MERRY CHRISTMAS every one !
« Last Edit: 25 Dec 2007, 17:45:53 by strike277 »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Camera Following terrain?
« Reply #7 on: 26 Dec 2007, 12:07:07 »
BTW, what is a Madebol ????

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Camera Following terrain?
« Reply #8 on: 28 Dec 2007, 15:35:21 »
Well Mandebol fixed my problem. Just to let you newbies out there know. If you use an sqf file verse a SQS you will not have to execute the sqf file. Simply place the sqf file in the mission folder and, if the code is correct it will work. Until I downloaded and installed the mission I didn't know this. Makes life very simple.
When a mission starts, it automatically runs init.sqs or init.sqf (depending on which one you have in the folder). This auto-execution is nothing to do with sqs or sqf formatting, but is just a side effect of placing one of these specific two files in your mission folder.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)