How to get a touch rotated actor to keep rotating and gradually decrease speed?
Partho
Member Posts: 3
Hi guys!
A hard googling newbie here.
I've managed to get an actor, fixed in position, to follow touch input to rotate. It nicely follows the finger.
But how do I get it to keep rotating on release, in the same speed as the finger moved it, and in the right direction?
And after that, slow down and finally stop?
Would really appreciate some help
A hard googling newbie here.
I've managed to get an actor, fixed in position, to follow touch input to rotate. It nicely follows the finger.
But how do I get it to keep rotating on release, in the same speed as the finger moved it, and in the right direction?
And after that, slow down and finally stop?
Would really appreciate some help
Comments
Interpolate self.Rotation to 0
Duration: "X"
X = a set time predetermined by you.
EDIT: You may be able to modify this tutorial to track the speed of the dragged finger.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Since it's a circular motion there probably is a way to do it by checking the and actors rotation angle and compare it to a previous value.
If the first angle was say 100° and the next 90° the direction of rotation would be clock wise.
But it's when the rotation passes 0° it gets tricky..
Lets say the first angle check gives 255° and the following gives 5°. According to the previous logic this rotation also would be clock wise. This may be true, if it was a fast rotation of a total of 250°. But if the rotation actually was performed counter clock wise it passed 0° and then actually is counter clock wise.
Any ideas how to solve this and I'll be a happy man.
Then I also could use the angle difference to determine the sped of the rotation.
If you use 'constrain self.rotation to self.time*100' then the 'angle' is always increasing, so you never suffer from the 0°-crossover-issue.
(use whatever you want for the '100' part, it simply controls the speed / degrees per second).
I get the idea. But my brain just can't wrap how I will incorporate that in the code making the actor rotating following touch. I already use a constrain self.rotation there.
I really appreciate you guys effort helping me out and it frustrates me that all the help you already been giving me doesn't make me solve this.
Here's a screen dump of the actors rules: https://www.dropbox.com/s/kso2604h9hzze5s/rotationproblem-01.jpg