GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Interpolate rotation

DuesDues Posts: 1,159Member

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

  • ThoPelThoPel GermanyPosts: 184Member, PRO
    edited July 2015

    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

  • DuesDues Posts: 1,159Member
    edited July 2015

    @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 :)

  • ThoPelThoPel GermanyPosts: 184Member, PRO
    edited July 2015

    @Dues said:
    The rotate behaviour won't work when you have a non movable actor.

    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

  • SocksSocks London, UK.Posts: 12,822Member
    edited July 2015

    @Dues said:
    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?

    360 doesn't equal 0 !

    Try constrain rotation to self.time * X

  • zweg25zweg25 Posts: 738Member

    you could also try self.rotation%360. (I suggest putting this in a round() function)

  • DuesDues Posts: 1,159Member

    Thanks @Socks and @zweg25 !

  • SocksSocks London, UK.Posts: 12,822Member
    edited July 2015

    @Dues said:
    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.

  • SocksSocks London, UK.Posts: 12,822Member
    edited July 2015

    @Dues

    Example project attached with weird and wonderful rotational movements using the above method . . .

  • DuesDues Posts: 1,159Member

    Thanks @Socks You're the best! :)

Sign In or Register to comment.