# Swipe Rotate - Is there an easier way?

Discussion and feedback on Construct 2

### » Tue Feb 14, 2017 3:52 am

I'm trying to spin a knob using a touch swipe control scheme for mobile.

first I tried using the physics behavior... no good.

so now I'm manually checking the direction of the swipe, and then the position of the swipe - since that would change the spin direction.

if there's no easier way, can anyone make suggestions to make this capx tighter? I actually have only tested this with the mouse so
far...

I'd also like to make it more kinetic and tried using Touchspeed, but I'm not sure how accurate the mouse is in replicating that. Currently that part is just commented out, but it wasn't working very well especially swiping up.
https://dl.dropboxusercontent.com/u/362 ... _spin.capx
B
101
S
34
G
16
Posts: 1,212
Reputation: 17,016

### » Tue Feb 14, 2017 6:24 am

Here's a math idea that simplifies it a bit.
Basically it's a torque calulation using a cross product.
https://dl.dropboxusercontent.com/u/542 ... _knob.capx
B
95
S
33
G
128
Posts: 5,491
Reputation: 81,570

### » Tue Feb 14, 2017 6:44 am

@R0J0hound wow, that does simplify it...

For the torque calc, I don't understand what the multiplying it by 3 does? lowering this gives it more drag maybe? I'd like to play around with the sensitivity and drag.
B
101
S
34
G
16
Posts: 1,212
Reputation: 17,016

### » Tue Feb 14, 2017 7:04 am

@R0J0hound actually, I think I got it... just had to mess with the numbers. this is great thanks for the help!

simple and brilliant... (I should study calculus II!)
B
101
S
34
G
16
Posts: 1,212
Reputation: 17,016

### » Tue Feb 14, 2017 7:37 am

The 3 was arbitrary because without it the object wouldn't spin enough. The math is just vector algebra an I probably butchered it a bit.
B
95
S
33
G
128
Posts: 5,491
Reputation: 81,570

### » Tue Feb 14, 2017 3:39 pm

R0J0hound wrote:The math is just vector algebra an I probably butchered it a bit.

oh haha.. I thought cross product was a calc thing..but maybe that's 3D?

https://betterexplained.com/articles/cross-product/
B
101
S
34
G
16
Posts: 1,212
Reputation: 17,016

### » Sun Apr 02, 2017 3:47 pm

Thanks so much!

R0J0hound wrote:Here's a math idea that simplifies it a bit.
Basically it's a torque calulation using a cross product.
https://dl.dropboxusercontent.com/u/542 ... _knob.capx
B
9
S
3
Posts: 26
Reputation: 794

### » Sun Apr 02, 2017 4:01 pm

@Milupa5 sorry! I don't have it the capx anymore - but I took a screenshot to show someone a while ago..

B
101
S
34
G
16
Posts: 1,212
Reputation: 17,016

### » Sun Apr 02, 2017 4:20 pm

You could probably use touch speed instead of distance.
B
173
S
50
G
194
Posts: 8,566
Reputation: 121,368

### » Sun Apr 02, 2017 8:53 pm

B
95
S
33
G
128
Posts: 5,491
Reputation: 81,570

Next