Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: kfboelter on December 08, 2013, 11:19:52 PM

Title: 3D object over NGUI Sprite/Button
Post by: kfboelter on December 08, 2013, 11:19:52 PM
Hi

I am trying to think out a way in which I will drag a 3D object on screen, and once it is over (or under, whatever) a NGUI object (button or sprite), it is destroyed...

We can think of it as a garbage can... I have a 3D object which I drag, and if it reached the NGUI object garbage can, I remove it from the scene...

Any ideas on how to get that done?

Thanks for the attention.
Title: Re: 3D object over NGUI Sprite/Button
Post by: ArenMook on December 09, 2013, 12:54:24 AM
Easiest thing to do would be to render the object into a render texture and drag the render texture (using UITexture).

If you really want to drag the 3D object itself, you will need to change its material to use a render queue that's higher than NGUI. NGUI by default uses render queues 3000 and up (+1 per each new draw call), although you can also set this value explicitly on panels.

P.S. I am assuming a 3D UI drawn using the game's camera here. If not, then you're in for more fun -- as NGUI is generally drawn using a separate camera, and you can't simply move one object from one camera to another. You'd have to mess with its layers, and ensure that the object appears in the same position, etc... it's much more difficult.
Title: Re: 3D object over NGUI Sprite/Button
Post by: kfboelter on December 09, 2013, 01:31:06 PM
Right, good tips...

Bit more info...

You mentioned Render Queue... it actually does not really matter in which order things are drown.. does not matter if it above or below the trashcan.. but thanks for the advice.

Now, as for the GUI.. I am using plain 2D gui...

What I thought of, is actually getting the info of weather the user has something being held while he enters button OnHover...

What about that? I will give it a shot, but if you see any flaws on that method, let me know

Regards o/