Game Maker Games, Articles, Tutorials & More

Game Maker Network


Howdy, Guest! Please sign in or register an account.

Print

rotate_smoothly_toward

By Daniel · December 24, 2008

Rotate some angle toward some other target angle with a given speed, slowing down as the target comes near

// rotate_smoothly_toward(dirOld, dirNew, rotSpeed)
return argument0 + sign(sin(degtorad(argument1 - argument0))) * (argument2 / 180) * abs(((((argument0 - argument1) mod 360) + 540) mod 360) - 180);

Categories: Motion

Comments

There are no comments to display.

Post a Comment

You must be signed in to post comments.

Advertisement