Jump to content
Tom212

cameraEffect and Zeus issue

Recommended Posts

Hi all,

 

I'm currently working on a system that uses Killzone Kid's UAV to r2t tutorial as a basis: http://killzonekid.com/arma-scripting-tutorials-uav-r2t-and-pip/

I succeeded in what I was hoping to achieve, I've got TV's that can cycle through the feeds of various UAV's. These UAV's have an action that allows them to lock their camera's focus to their laser target. This means that their feed shows the targeted position without a gunner being active, allowing TV's to be setup to show particular points of interest on the fly during the mission.

 

However, I hit a small problem. It appears that switching camera messes with the cameras/procedural textures I've setup and I'm not sure why.

 

I first noticed that entering and exiting the arsenal would break all the camera feeds, they would just stream as black. I found that this could be resolved by running the script that setup the UAV cameras again so I added an action to the arsenal allowing players to 'fix tv feeds'. The code that sets up the cameras is as follows:

//Spawns camera and streams to render surface.						
Cam1 = "camera" camCreate [0,0,0];
Cam1 cameraEffect ["Internal", "Back", "uav1rt"];
							
//Attaches the Camera to the UAV gunner position.
Cam1 attachTo [UAV1, [0,0,0], "PiP0_pos"];
							
//Makes the camera zoom in a bit.
Cam1 camSetFov 0.1;

//Sets camera to normal display.
"uav1rt" setPiPEffect [0];

Cam1Handler = addMissionEventHandler ["Draw3D", {
	_dir =
	(UAV1 selectionPosition "PiP0_pos")
		vectorFromTo
	(UAV1 selectionPosition "PiP0_dir");
	
	Cam1 setVectorDirAndUp [
		_dir,
		_dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]
	];
}];

UAV1 addAction ["Set Focus On Laser", {[UAV1, UAV1FocusObj] remoteExec ["FNC_FocusOnLaser", 0, true];}, nil, 1.5, false, true, "", "true", 0.1];
UAV1 addAction ["Reset Focus", {[UAV1] remoteExec ["FNC_ResetFocus", 0, true];}, nil, 1.5, false, true, "", "true", 0.1];

Not ideal but a fine duct tape fix.

But then a larger issue was met when I tested with Zeus. Changing camera into/out of Zeus broke the camera feeds like the Arsenal did, running the above code again did seem to fix the camera feeds but created a nasty side effect that caused the Zeus camera to no longer run smooth, it would just jut around updating position only every few seconds in response to my input. Using comments I tried to debug the exact command that caused this and deducted that it was cameraEffect. 

The BIS page for cameraEffect has the following warning which I feel is probably the issue, I just don't really understand it as I'm new to alot of these features:
"One cannot mix and match cameraEffect and can either have multiple r2t cameras or a single camera for the whole screen. If one needs a background stream overlayed with r2t streams, this could be achieved by creating an object and using switchCamera to switch to it for background image, while using cameraEffect for r2t overlay (see Example 4)"

I'd highly appreciate it if people could help explain this issue in more detail/help me understand the above warning, or otherwise suggest a fix.

 

Thanks for reading and your time.

Share this post


Link to post
Share on other sites

I guess for fixing u just need to use:

Cam1 cameraEffect ["Internal", "Back", "uav1rt"];

to set the cam feed back to cam1 again.

 

Try to not create a new cam, the EH and all those stuff again to fix the problem...

Share this post


Link to post
Share on other sites

I had an issue when using a camera on an intro. Easy fix for me as I just ran the UAV script at the end of the intro (which funny enough is a tweaked version of KK's script you mentioned above).

 

For yourself, you need some flexibility.

 

I found this Reddit post that seems relevant. 

 

Share this post


Link to post
Share on other sites
53 minutes ago, sarogahtyp said:

I guess for fixing u just need to use:


Cam1 cameraEffect ["Internal", "Back", "uav1rt"];

to set the cam feed back to cam1 again.

 

Try to not create a new cam, the EH and all those stuff again to fix the problem...


Thanks that's a much more elegant solution to my first problem. cameraEffect is still messing with my Zeus camera however.

 

14 minutes ago, JasonO99 said:

I had an issue when using a camera on an intro. Easy fix for me as I just ran the UAV script at the end of the intro (which funny enough is a tweaked version of KK's script you mentioned above).

 

For yourself, you need some flexibility.

 

I found this Reddit post that seems relevant. 

 

 

Thanks Jason, I'll take a look at that seems super relevant!

Share this post


Link to post
Share on other sites

The Reddit post was useful as it pointed me in the direction of an event handler I could use to hook up the tv's again after exiting the arsenal so thanks.

 

Having reread the warning on the cameraEffect page I don't think it's possible to have r2t cameras active while in the zeus interface as it's a 'single camera for the whole screen':
One cannot mix and match cameraEffect and can either have multiple r2t cameras or a single camera for the whole screen. If one needs a background stream overlayed with r2t streams, this could be achieved by creating an object and using switchCamera to switch to it for background image, while using cameraEffect for r2t overlay (see Example 4)

 

If anyone has some suggestions on methods of circumventing this I'd appreciate them :).

 

 

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

×