Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Slater on June 06, 2014, 09:54:41 PM

Title: GUI Camera
Post by: Slater on June 06, 2014, 09:54:41 PM
So I finally took the time to create a separate camera for GUI. Before I had everything in just one "Main Camera" which was problematic when I wanted to zoom in with orthograpic size.

Everything works great and I have set the GUI Camera to depth 1 and depth only. The only problem I have is that only the GUI Camera is working with the touch. So when I touch the menu stuff and GUI items in the scene that are located in the GUI Camera, it works great, but the stuff that should be touchable (Touch Object Event) in the Main Camera doesn't work. If I add that the Main Camera is Main Camera from the Action Browser I get the Main Camera object to work with touch but not the GUI Camera items. I want the items with Colliders and "Touch Object Event" in both cameras to be working at the same time. What am I missing?
Title: Re: GUI Camera
Post by: Slater on June 07, 2014, 11:46:24 AM
Need help on this! Is what I am reading true, that Touch Object Event Only works for the Main Camera? How do I solve this? This is very limiting.
Title: Re: GUI Camera
Post by: 1982 on June 08, 2014, 05:05:27 AM
Can you tag both cameras as "Main Camera", does it work?
Title: Re: GUI Camera
Post by: Slater on June 08, 2014, 08:54:37 AM
Thanks for the suggestion. Tried it already but you can only have one main camera it looks like. It didn't work.
Title: Re: GUI Camera
Post by: Slater on June 19, 2014, 06:52:34 PM
Is there no good solution to this?
Title: Re: GUI Camera
Post by: redikann on June 19, 2014, 07:24:05 PM
Did you try parenting empty gameobjects with colliders to anything touchable being rendered with the main camera and set these colliders objects to a render layer by the GUI camera. I've never worked with touch so I could be way off.
Seems the touch event has to be passed thru the main camera.
Title: Re: GUI Camera
Post by: Slater on June 19, 2014, 09:40:57 PM
Not really sure what you suggest here, but a solution is to put an empty game object with just a collider in it and place it within the GUI Camera at a corresponding coordinate to the object in the main camera and have that set for GUICamera in the layer (That is what I named my camera layer). That way it works, since all the touch will then be in the GUI Camera. Not sure how well it works when I start zooming in and out on the Main Camera though.
Title: Re: GUI Camera
Post by: redikann on June 19, 2014, 10:06:00 PM
Well it could be at the physical location of the object you want to touch (parenting) . It actually wouldn't have a mesh renderer and zooming the main camera shouldn't be able to physically distort the collider. But I don't know just a thought.
Title: Re: GUI Camera
Post by: Slater on June 21, 2014, 11:22:30 AM
If I have the collider placed within the main camera area it doesn't work if GUI Camera is set to be "Main Camera" and the collider has GUI Camera as layer.
Title: Re: GUI Camera
Post by: redikann on June 21, 2014, 09:13:05 PM
The collider would be on the gui layer but the gui cam would also have to be set to render that layer. But again all this could be wrong.
Title: Re: GUI Camera
Post by: Slater on June 21, 2014, 09:15:46 PM
Yes that is how I have it now. GUI Camera only renders the GUI layer. And the collider is set with GUI layer. When placed within GUI Camera it works. When placed within the Main Camera (which is not set to main camera, I have done "Set main camera" with playmaker on the GUI Camera in order for that to respond to touch)it does not work.