Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Lieven on September 05, 2013, 12:42:16 PM

Title: Rendering a 3D object in front of a 2D camera GUI
Post by: Lieven on September 05, 2013, 12:42:16 PM
Hello,

I am trying to make a scene with NGUI where the player's vehicle transforms from a submarine to a car and later on from a car to a helicopter.

The idea is to do this with a UITexture in the background and the vehicle in front of it. I did manage to do this when the game is not running, I mean I can see the vehicle in front of the background plane when I open the game view of the scene, but whenever I hit the play button, the background comes in front of the vehicle. I work with 2 cameras for this purpose: a game camera to render the vehicle and a NGUI 2D camera to render the background. I thought it would be as simple as to make my vehicle camera render after the gui camera to make the vehicle pop up in front of the background, but this does not seem to work when I start the game.

I have been trying out some camera settings, but nothing seems to fix the problem. Is there something I am missing here?

The settings for the vehicle camera are:

The settings for the gui camera are:

Thanks in advance,
Lieven.
Title: Re: Rendering a 3D object in front of a 2D camera GUI
Post by: ArenMook on September 05, 2013, 08:26:50 PM
This seems unusual... you're drawing your UI camera before the game camera?

In any case, yes that's how it works. Camera with higher depth is drawn later.
Title: Re: Rendering a 3D object in front of a 2D camera GUI
Post by: Lieven on September 07, 2013, 11:24:29 AM
Couldn't really get it to work with the 2 cameras, but I fixed it by using only one camera and a 3D GUI. So for me the issue is solved, but it still exists. I know I tried to do something unusual, but it should've worked I think.