Jump to content
Sign in to follow this  

[solved] Chopper cockpit camera

Recommended Posts

Hello all,


I've been having some difficulties in making a decent cockpit camera from the pilot's POV. Right now any scripts I've used to try and attach a camera to the chopper have very choppy (😅) results. I haven't really tried the eachFrame eventhandler as I'm not sure of the syntax. In any case, I'm not sure what to make the camera look at exactly...as there is no predefined target.


I should mention that the chopper is currently executing a unit play path - which means that the pilot is an AI, not the player. This means that you can't simply use a switchcamera "internal", remove the HUD, slap on some cinema borders and call it a day. Unless I use the co-pilot's POV...because I can make the co-pilot the player and do the things I just mentioned. But I'd rather use the pilot's POV, not the co-pilot - as it's more appropriate for the cutscene.


Any ideas would be very much appreciated.




Share this post

Link to post
Share on other sites


This is roughly how the cameras work in Fly Tanoa Air,


pos1 = camMOUNT modelToWorld [0,0,0];
pos2 = camTARG modelToWorld [0,0,0];

cam = "Camera" camCreate (camMOUNT modelToWorld [0,0,0]);
cam cameraEffect ["internal","back","rtt"];
"rtt" setPiPEffect [0];
sleep 0.5;
cam camSetDir (pos1 vectorFromTo pos2);
	cam camCommit 0;
[cam, (vehicle player), true] call BIS_fnc_attachToRelative;

camMount is a helper where the camera will spawn and can be already hidden / attached to vehicle-- but must be deleted after the camera is created or else the vehicle's movement will be wonky.

camTARG can also be attached relatively to the vehicle and sets the angle which the camera will face (should also be deleted after camera creation).

I think this could be greatly improved with a function. I'll do that if I get a chance.

Have fun!

  • Like 4

Share this post

Link to post
Share on other sites

Thanks for the quick response @wogz187.


It turns out that even when the player is in control of a vehicle, the unitplay script will still work. Very strange yet interesting, especially as I'm sure I've read that it doesn't work if the player is in control of the vehicle. This actually solves my problem of having a cockpit view as I can simply use the switchcamera "internal" command.


But your script snippet may still be useful for attaching cameras to vehicles, or indeed if I need a cockpit view that's not necessarily from the pilot's POV - so thanks for the help!

  • Like 1

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