Question by
Hassang · Oct 04, 2020 at 07:09 AM ·
rotate objectswipesnapsnapping
Swipe to rotate an object and when it reach 30° snap it to 90°
The problem I wanted to solve :
When I swipe the screen in the right direction,
the cube starts to rotate on the Y axis,
and when it reach 30°, the cube y rotation snaps smoothly to 90°.
The same for the left direction with negative values.
And by smoothly i mean a fast animation to 90° and not abrupt change to it. But this is a second issue, not the most important.
I tried and combined a lot of codes in vain, read about quaternion and eulers yet couldn't figure a proper solution.
I hope you guys could help me with your knwoledge as am new to unity. Thank you very much.
swiperotatesnap.jpg
(83.8 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613013042im_/https://answers.unity.com/themes/thub/images/avi.jpg)