Jump to content
Sign in to follow this  
trini scourge

Attaching camera to aircraft

Recommended Posts

Hi folks, i'm trying to fix the camera to the wing or nose of an aircraft, but the camera is fixed and doesn't move along with the aircraft.

Can anyone help me out?

tr1n.

Share this post


Link to post
Share on other sites

Create a script that loops

cam camsetrelpos [x,y,z]

cam camcommit 0

I suggest using 2 cameras for what you are trying to do (I assume you dont want the center of the plane to be in the center of the screen). One that the view is from and the other to be targeted by the first camera. Both cameras need a loop for updated position ofcourse.

Share this post


Link to post
Share on other sites

Hi Trini

I am no scripting guru by any means, but you aren't getting much help here so I will suggest trying this code in your camera.sqs when you want the vehicle to be followed:

#loop1

;set yourvehiclename to the vehicle name you want to follow

_camera camsettarget yourvehiclename

;increase the last 2 numbers for bigger vehicles

_camera camsetrelpos [0,-10,3]

_camera camcommit 0

@camcommitted _camera

~0.01

;to deactivate the script, have a trigger that has triggeractname in the on activation field

?triggeractname : goto "loop1"

Maybe the last line of code will need to be ?triggeractname == 1 : goto loop1.... not sure. haven't got time to check if it works at the mo.

If this doesn't work maybe try looking into how bullet cams work and adjust to make work for a vehicle.

Stuntboy

Share this post


Link to post
Share on other sites

Thx for the help guys biggrin_o.gif

Stuntboy i'm at work right now so cant test it out, but i will as soon as i get home.

Thx again!

tr1n.

Share this post


Link to post
Share on other sites

Hi there

@ Stuntboy

Could you please explain in a little more in detail, i have been trying to do this for the last three days and all i get is an error and the camera doesnot follow the vehicle

The help would be much appreciated

Share this post


Link to post
Share on other sites

Search for a VehicleCam script here or at ofpec, i have one that i use. It was from the old OFP days, i think i got it from another mission. I certainly didnt make it.

Cheers

GC

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">cam1="camera" camcreate [0,0,0]

cam2="camera" camcreate [0,0,0]

cam3="camera" camcreate [0,0,0]

cam1 camsettarget plane1

cam2 camsettarget plane1

cam3 camsettarget cam1

cam3 camcommit 0

cam3 cameraeffect ["Internal","back"]

#Loop

cam1 camsetrelpos [5,2,0]

cam2 camsetrelpos [5,-2,0]

cam1 camcommit 0

cam2 camcommit 0

cam3 setpos getpos cam2

?!ExitCam:goto "Loop"

cam2 cameraeffect ["Terminate","back"]

camdestroy cam1

camdestroy cam2

camdestroy cam3

exit

It wont follow the wing up/down when the plane turns but it works if the plane flies in a straight line. You  might want to tweak the relpos values a bit I only made it work I didnt try to make it look perfect.

Share this post


Link to post
Share on other sites

I used:

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

_c = "camera" camCreate getPos plane1

_c cameraEffect ["internal","front"]

_c camSetTarget plane1

_c camSetFov 0.7

_c camCommit 0

#loop

_c camSetRelPos [0, 9, -0.5]

_c camCommit 0

? useCamera : goto "loop"

_c cameraEffect ["terminate","front"]

camDestroy _c

It worked just fine smile_o.gif

Share this post


Link to post
Share on other sites

@ everyone

notworthy.gifnotworthy.gif

yay.gif

it works now

Thanks a lot guys cant thank you enough this what makes arma great

once again thanks

Share this post


Link to post
Share on other sites

You may want to add a wait command within the loop so it doesn't use as much cpu:

~.01

Share this post


Link to post
Share on other sites
You may want to add a wait command within the loop so it doesn't use as much cpu:

~.01

I tried that first and it got really choppy, dont ask me why, i thought it shouldnt. Its not like you are gonna notice a FPS difference anyway.

Share this post


Link to post
Share on other sites

Hola!

Just a quick question:

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

_c = "camera" camCreate getPos chopper

_c cameraEffect ["external","back"]

_c camSetTarget chopper

_c camSetFov 0.7

_c camCommit 0

#loop

_c camSetRelPos [0, -9,1.5]

_c camCommit 0

?(_time < 15) : goto "loop"

_c cameraEffect ["terminate","front"]

camDestroy _c

How would I get that to exec from a trigger/addaction, but only to the person who initiates it?

So far, when someone steps on it in MP, everyone gets it sad_o.gif

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!(player in list TriggerName):exit

Share this post


Link to post
Share on other sites

Short n sweet wink_o.gif

So if I do this:

Trigger " none ", Name " camtrig " : Cond: player distance camtrig < 2

act: addaction etc.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?!(player in list camtrig):exit

TitleCut["Chopper Cam Initialized","Black out"];

~2

TitleCut["","Black in"];

_c = "camera" camCreate getPos heli1

_c cameraEffect ["external","back"]

_c camSetTarget heli1

_c camSetFov 0.7

_c camCommit 0

#loop

_c camSetRelPos [0, -9,1.5]

_c camCommit 0

?(_time < 15) : goto "loop"

TitleCut["Camera Link: Closing","Black out"];

~2

TitleCut["","Black in"];

_c cameraEffect ["terminate","back"]

camDestroy _c

Then the addaction and camera will only show for those who activate it?

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  

×