1

I have 2 GameObjects, the first one is on a 2D interface (plane), and the second one is a 3D character (also sitting on a plane), so the 2D texture represents the 3D character in the game,

I want to drag the 2D texture and have the 3D character move with it, but I want it to be proportional, for example if the 2D texture reached half of its plane the 3D character must be as well at same position accordingly, and the 2 planes are not equal as well (width-height), for example 2D plane is 2x3 and 3D plane is 9x5,

Can anyone please help doing this ? PS: I am using NGUI to draw my 2D interface

Steven
  • 166,672
  • 24
  • 332
  • 435
Alexy Ibrahim
  • 554
  • 1
  • 7
  • 20

1 Answers1

0

I think i understand your question. You might want to make a class that scales all the movements. (I do this when making GUI's so that screen size doesnt matter)

XofPlayer = (Xof2d/widthof2d)*widthof3d

Does this make sense? IF you have the size of the 2d plane and an object get to half way on that plane. The player will then also be halfway on their plane. No matter what the two sizes are. You would do the same thing with the Z axis for depth. And I guess Y if you need it.

crychair
  • 337
  • 3
  • 20