Interpolate rotation
Dues
Member Posts: 1,159
Hey guys,
Just a quick question...
I know you can interpolate self rotation of a non movable actor, but I can't seem to get it to constantly rotate. It rotates one time then stops
If I do like this:
Rule: If self.Rotation = 0
--Interpolate self.Rotation to 360
It should continue since 360=0 right?
Comments
Why don't you use the "Rotation Behavior"?
In my opinion, you need to reset the rotation.
If self.Rotation = 0
-Interpolate self.Rotation to 360
if self.Rotation = 360
- self.Rotation = 0
@ThoPel The rotate behaviour won't work when you have a non movable actor.
I don't think you would need to reset the rotation since 360=0. I have tried both ways and none of them seems to work
Okay, I did not know that
Played around a bit, the only thing which works (more or less).
Timer after 0.01
-If self.Rotation = 0
--Interpolate self.Rotation to 360
360 doesn't equal 0 !
Try constrain rotation to self.time * X
you could also try self.rotation%360. (I suggest putting this in a round() function)
Thanks @Socks and @zweg25 !
Another way would be:
Constrain rotation to rotation +1
(which would be - on a game running at a healthy 60fps - a CCW rotation speed of 60°/sec)
Changing the +1 to a -1 would change the rotation direction, and changing the value would change the speed (the speed is measured in degrees per frame).
This is more controllable than the [constrain rotation to self.time * X] method as you can swap the '+1' (in [Constrain rotation to rotation +1]) for an attribute and alter that attribute however you like, so you can control the speed, direction, acceleration of rotation and so on.
@Dues
Example project attached with weird and wonderful rotational movements using the above method . . .
Thanks @Socks You're the best!