Jump to content


Photo

Smooth rotation


  • Please log in to reply
4 replies to this topic

#1 hhAnt

hhAnt

    GMC Member

  • GMC Member
  • 3 posts
  • Version:GM8

Posted 15 December 2012 - 11:40 AM

Hey,

Is there a way to rotate a simple figure smoothly?, e.g. a square, to spin it 45 when pressing a key I use

image_angle = direction;
direction = 45;

this make it in a abrupt way, how can I change the velocity of this motion? e.g. slow down

please help , thanks.

Pd. Ive seen a similar topic in "Advanced GML discussion" section but is very complicated for me, I ask for a more straightforward answer if is possible
  • 0

#2 shinyjiggly

shinyjiggly

    a lame wanderer

  • GMC Member
  • 128 posts
  • Version:GM:Studio

Posted 15 December 2012 - 11:58 AM

Find a way to change the rate of the rotating smoothly over time until the the image has arrived at the correct rotation. The closer it is to the specified rotation, the slower it will go. Don't forget about the initial buffer, but try to have the amount of buffer dynamic as to not make it get in the way of other parts of the rate change.

Remember: it's not going to go 1 degree per step or whatever all the time, but depending on how close it is top its stopping point, it should adjust the rate until it evens out again. That being said, you'll probably need a variable for the interval, for the max rate, the direction goal, and maybe a couple others. Try to visualize it on a line graph. Would it be straight, or would it it be curved? Hopefully this has given you some hints on how to tackle this.
  • 0

#3 hhAnt

hhAnt

    GMC Member

  • GMC Member
  • 3 posts
  • Version:GM8

Posted 15 December 2012 - 05:39 PM

Thanks for you reply,

Ill try to focus this way, I think it is using the elapsed time of the clock system, right?

greetings.
  • 0

#4 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 20901 posts
  • Version:GM:Studio

Posted 15 December 2012 - 05:43 PM

http://gmc.yoyogames...dpost&p=4160261

Posted Image
  • 0

#5 hhAnt

hhAnt

    GMC Member

  • GMC Member
  • 3 posts
  • Version:GM8

Posted 15 December 2012 - 06:06 PM

:thumbsup:

thanks a lot, Nocturne.

Edited by hhAnt, 15 December 2012 - 06:07 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users