Using interpolation (lerp) on Angle

For questions about using Classic.

Post » Thu Feb 11, 2010 9:21 pm

Touch, sir Deadeye! :D

That's it!
Damn, I never understood how timedelta can make accelerations... Thanks a lot!
B
107
S
40
G
10
Posts: 456
Reputation: 13,202

Post » Fri Feb 12, 2010 12:00 pm

[quote="Ashley":3lilltws]newt's solution is probably the best idea. I thought I'd made an Angle Lerp expression, but I wrote it for something else. Might be useful to add to the next build?[/quote:3lilltws]

You could add a "Rotate towards angle" function for sprites while you're at it. Right now you have to use a workaround like "Rotate towards position: Sprite.X+Cos(TargetAngle)*10, Sprite.y+Sin(TargetAngle)*10", which isn't really all that intuitive.
B
16
S
8
G
4
Posts: 136
Reputation: 3,144

Post » Fri Feb 12, 2010 12:10 pm

[quote="Daiz":4pectp42]You could add a "Rotate towards angle" function for sprites while you're at it.[/quote:4pectp42]

Agreed, it would be nice. I've been caught more than once staring blankly at the angle actions and scratching my head in confusion before remembering it doesn't actually exist.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Feb 12, 2010 7:38 pm

set rotation to (sprite.angle + (angledifference(sprite.angle,desiredangle)*factor*timedelta))

will rotate the sprite towards the angle you put in desiredangle at a rate of factor per second.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Fri Oct 05, 2012 10:56 pm

@Madster this just keeps turning clockwise what if one wants to go anticlockwise.
B
9
S
2
Posts: 100
Reputation: 1,335

Post » Fri Oct 05, 2012 11:01 pm

well that's an old post...
B
107
S
40
G
10
Posts: 456
Reputation: 13,202

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests