Interpolated angles

New releases and general discussions.

Post » Sat Apr 02, 2011 4:20 pm

I'm sure most of us are aware of the issue of using lerp to set a sprite angle because of the fact that it only accepts 0- 360, so anything above 360, or below 0 gets reset.
That pretty much makes that useless,... but I've figured a way around this issue, and I thought I would share it here to help others, as well as add a suggestion for some future C0.xx update to make it even more useful.

[code:1kyx5g52]-> Sprite: Set animation angle to lerp(Sprite.animationangle,Sprite.Value('angle'),1-0.005^timedelta)[/code:1kyx5g52]

Set animation angle is not restricted by the 0-360 limit, so you can set it to what ever value you like.
However... anyone experimenting on this will probably notice that there is no get Sprite.animation angle.
You can use a pv instead, but for ease of use, I think the expression is definitely needed.
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Sun Apr 03, 2011 12:33 am

Didn't I add an anglelerp expression a few builds ago? I can't check right now, my laptop's broken!
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Sun Apr 03, 2011 1:07 am

Not that I know of. There's the system expressions angledif(a,b), and rotateangle(start,end,step), but nothing to override the normal limit without a few extra events.
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Sun Apr 03, 2011 5:07 am

here ya go:
http://dl.dropbox.com/u/1013446/math.rar

I've been meaning to release a math thing for a while, consider this plugin fully working and stable, anything I add from here won't interfere with old caps. I'll probably add 3d math next. this is an easy to make and easy to use thing I'll have no trouble adding to as I work on my current project

example usage:
http://dl.dropbox.com/u/1013446/angler.cap


ps: s has this function but I oopsed it up. I"ll have to fix that later
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sun Apr 03, 2011 6:25 am

Cool!
Pretty good idea too, considering the current development status.
Image Image
B
161
S
48
G
91
Posts: 7,358
Reputation: 67,271

Post » Mon Apr 04, 2011 9:58 am

Very cool addition indeed lucid!

I mostly made use of the 'Is angle clockwise/anticlockwise' condition and rotated the object accordingly using lerp(like in this thread), but this seems a lot handier.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 1 guest