Half sine?

For questions about using Classic.

Post » Fri Sep 10, 2010 4:45 am

[quote="madster":254amdtq]Actually it would be useful to be able to store mathematical functions :P
Perhaps it's easy to do so with Python?[/quote:254amdtq]

Yeah, a script would probably work nice. As I recall there is a folder for snippets somewhere.
Thanks guys
Image ImageImage
B
165
S
49
G
146
Posts: 8,039
Reputation: 96,070

Post » Fri Sep 10, 2010 5:36 am

You know, you guys could always just use functions. Name the function object F, make an on function abscosp and set the return value to:
lerp(.Param(1),.Param(2),abs(sin(lerp(0,180,.Param(3)))))

Then you can use it with F.abscosp(a,b,t) anywhere you want.
B
18
S
8
G
4
Posts: 137
Reputation: 3,196

Post » Fri Sep 10, 2010 6:42 am

[quote="Daiz":2g9fvp9b]You know, you guys could always just use functions. Name the function object F, make an on function abscosp and set the return value to:
lerp(.Param(1),.Param(2),abs(sin(lerp(0,180,.Param(3)))))

Then you can use it with F.abscosp(a,b,t) anywhere you want.[/quote:2g9fvp9b]
While you're right in general, the difference to using Python is that once written you can use the very same script/module etc in every project without the need of rewriting it. You can literally build your own library, and as long as Construct does not support "outsorcing", Python would be the only way.
Image
B
24
S
8
G
10
Posts: 1,821
Reputation: 8,279

Post » Fri Sep 10, 2010 11:52 am

Care to show us a graph of your interpretation of this "half sine"? I'm confused. :?
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,170

Post » Fri Sep 10, 2010 6:15 pm



As you can see a full wave would go below the start point. Just like how the sine behavior works.

I'm just trying to do the hump, with an option to have it oscillate, along a single axis that is.

It's relatively easy for a non math wiz like me to get interpolation from point a to b. Its not that hard to have it do the inverse using some sort of state machine. But that's not very elegant, as it would take more than one event, and a pv or two.
Image ImageImage
B
165
S
49
G
146
Posts: 8,039
Reputation: 96,070

Post » Fri Sep 10, 2010 9:18 pm

Uh... that looks like |sin(x)| to me. Yes, absolute value.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,170

Post » Fri Sep 10, 2010 9:51 pm

Yeah I kinda see that now. Problem is I had a hangover the semester that had the trig class.
Image ImageImage
B
165
S
49
G
146
Posts: 8,039
Reputation: 96,070

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: nelmos2012 and 2 guests