Search Unity

Rotating objects in increments with swipe.

Discussion in 'iOS and tvOS' started by therobear, Aug 4, 2012.

  1. therobear

    therobear

    Joined:
    Sep 28, 2010
    Posts:
    22
    Hello,

    Forgive me if this question has been asked before. I am trying to rotate an object with swipe. If the swipe is going up in the y direction, the object will rotate in 90 degrees increments clockwise. If the swipe is going down in the y direction, the object will rotate in 90 degree increments counter clockwise. I have the swiping down, but what i have trouble doing is telling it which direction to go to. I have tried using Mathf.MoveTowards angle, but that just rotates the object to point at 90 degrees or -90 degrees. I do not want to use slerp or lerp because i dont want the rotation to slow down towards the end of its rotation. I would normally look at the Unify Community first, but since it's down, I thought I would come here and ask. Any help is greatly appreciated.

    Thanks!