Author Topic: Drag Sprite prefab from 2D orthographic to 3D perspective  (Read 2042 times)

Genhain

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 38
    • View Profile
Drag Sprite prefab from 2D orthographic to 3D perspective
« on: October 15, 2014, 07:30:29 AM »
So my current setup is that i have some prefabs in the orthographic UIRoot camera and i wish upon drag they transition to 3d space not too different from this http://www.tasharen.com/forum/index.php?topic=4543.0 except the item i want to be in 3d space is already being dragged, rather than dropping the item which is still in 2d space and creates an object it reference in 3d space.

The trouble to me seems that an NGUI Sprite or anything that derives from UIWidget is made in such away that it if it's not parented to a UIRoot with an orthographic Camera it will create one and parent it. So can a UIWidget be put in 3d space?

if not that means as an alternative on drag start i create a 3d version of the card without any uiwdgets and have that be dragged by the mouse instead...the issue with that is they are not simple objects so recreating them again from scratch will be tedious but if it's the only way, necessary.

or thirdly should i have made my camera perspective from the start and be using a perspective camera for my objects?

to get a better idea of what im trying to achieve here are a screen from Magic the gathering:Duels of the planes walkers http://nerdsworthacademy.com/wp-content/uploads/2010/10/indicator.png or for video reference http://youtu.be/h-e203r7SLg?t=9m53s(if it didnt skip ahead go to 9m53s)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Drag Sprite prefab from 2D orthographic to 3D perspective
« Reply #1 on: October 16, 2014, 06:25:13 AM »
There is no easy way of doing something like that. You cannot transition from 2D to 3D seamlessly. Best you can hope for is a small jolt when you do that.

To have a 3D UI element, you must make it parented to a UIPanel. It doesn't need a UIRoot in there -- as long as you have a UIPanel on its parent, it will work.

Genhain

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 38
    • View Profile
Re: Drag Sprite prefab from 2D orthographic to 3D perspective
« Reply #2 on: October 17, 2014, 02:54:46 AM »
It's fine I spoke with some colleagues and they said they had to have a 3D UI at some point and they informed just to have a perspective Camera under the UIRoot and make your 3D elements accordingly, so far I have not run into any trouble.