playMaker

Author Topic: How can I make a rotating handle that the player can drag to rotate ?  (Read 1093 times)

CoD67

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Hi guys , I currenctly suck with this . I'm having a wheel with a handle , I want the players to be able to touch and drag the handle in clockwise motion to rotate the entire wheels and when the players drag the handle counter clockwise , the wheel will stuck and won't rotate back .
Here's some images if you don't understand .




Thanks so much :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14374
  • Official Playmaker Support
    • View Profile
Re: How can I make a rotating handle that the player can drag to rotate ?
« Reply #1 on: March 05, 2015, 01:15:16 AM »
Hi,

 for this, you have to do the following:

 when the user touch your drag handle, you have to look at the touch position during the drag, that's all you'll need to do from then on during the drag. don't try to manually rotate or get any value ouf of the drag information, a simple look at will do.

 Bye,

 Jean

CoD67

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: How can I make a rotating handle that the player can drag to rotate ?
« Reply #2 on: March 05, 2015, 01:52:19 AM »
Thanks for the help :D , but how can I only allow the players to rotate clockwise and make it that when the player rotate counterclockwise the wheel will stuck .

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14374
  • Official Playmaker Support
    • View Profile
Re: How can I make a rotating handle that the player can drag to rotate ?
« Reply #3 on: March 05, 2015, 02:27:25 AM »
Hi,

 for this, you'll need to insert a level of abstraction.

 your lookat will be an indication of where the user want's to go, you won't turn the button yet, you'll be checking every frame that the signed angle between the last frame and this frame is no negative, and only if positive you'll match the lookat.

 this will make a solution that still may not be what you want, cause I can go 70° in negative, and as soon as I will rotate 1° positive the button will jump to where the touch is, it could be what you need tho.

 if you want an absolute lock, that is if the button is at 20° and the user can not go backward on the 20°,  and will not progress further until the touch is back to the 20° and more, then you'll need to maintaint this absolute value as a reference, so that the lookat isn't enough to decide:

 Everyframe that the positive drag is validate, you'll be saving the current absolute angle of the button, and so you'll be adding second check to your enabling: is the user rotating in a positive direction AND the absolute angle of the current look at is more then the last validated angle. this can be done easily with the button angle itself, that will likely be an indication of the absolute angle.

 experiment with this. It's not the easiest behavior to develop for sure, so progress step by step and really have a global vision of the behavior you want before implementing it, it will be difficult to go by chance or trial and error here.

 Bye,

 Jean