Author Topic: Rotate Ngui Object With Touches  (Read 2245 times)

sirwalek

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Rotate Ngui Object With Touches
« on: September 15, 2014, 07:29:08 AM »
Hi all,
I am trying to make a steering wheel. I did it onGui with drawing textures. Now i want to do it with Ngui.  But i couldnt figure out how to rotate steering wheel based on my touch moves. I couldnt find any tutorial about how to work with touch phases. What exactly i want to do is if my touch (in a spesifict rect) moves around a pivot point, i want to rotate steering wheel as u can imagine. I have no idea how to do that with NGUI. Any help, any tutorial link, any document to start would be great.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Rotate Ngui Object With Touches
« Reply #1 on: September 16, 2014, 08:36:33 AM »
NGUI sends out OnDrag (Vector2 delta) events to you as you're dragging something. Determining the angle is a simple matter of doing some math. Knowing where you started, and where you are now, as well as the pivot point of the rotation, calculate the angle difference and rotate the object.