0 Favourites

How do I rotate an object with smooth animation?

  • Hi,

    This is my first question and first post overall.

    I'm trying to rotate an object with its own pivot point at the bottom. The image file has the object on the uppermost part of the canvas (around 15%, like a banner ad) with the rest as empty. I made it this way so it's easier to rotate.

    When I use an action Rotate Counter-Clockwise 90 degrees, it works fine. But what I wanted to add is a smooth animation of the rotation taking place, with the speed of the rotation being modifiable. Is this possible? How do I do it?

    Thanks for any replies in advance!

  • I forgot to mention, the object should only rotate when I press the left or right arrow keys, for counter-clockwise and clockwise directions respectively. I've already done that and that works fine too.

  • I'm also struggling with this. I could very well be wrong but this is my understanding on how it's done:

    I believe you want to use the "Rotate towards angle" action.

    You need to have a trigger that is constant until your object has reached the desired angle. In other words, this way the action is looping every tick until it you get to the desired angle.

    The "Degrees" parameter is how many degrees it'll rotate each tick and the "Angle" parameter is the desired angle.

    As a side note you'll probably want to use the delta time expression with the "Degrees" parameter so that the speed isn't linked to the frame rate.

    This does seem a bit long winded to me which makes me think I've got it wrong. If anyone has a better method I'd be interested also.

  • Mikerbice

    g3xas

    this is how you do it manually wihtout plugins, i must admit that i struggle with it for half hour XDD

    becuase i use some plugins to do it more easy, in case you want to use them, here <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    (rex rotate to behaviour)

    http://c2rexplugins.weebly.com/rex_rotateto.html

    there is more ways, this is a very basic one.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Thanks, Lunatrap.

    Your attached capx is almost exactly how I've been doing it with instance variables, so that gives me confidence my thought process. Thank you also for the link to the plugin. I will have to check that out.

  • Mikerbice

    you are welcome

  • Thanks Lunatrap and Mikerbice for the replies. I'll check out the solution you posted Lunatrap!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)