Sine Functions in Construct 2

Discussion and feedback on Construct 2

Post » Tue Aug 06, 2013 11:32 am

Hey guys, I work on a small procedrual generated sidescoller. So I used GeoGebra to make a sine function which generates some seed based pseudo-random numbers. My problem is that Constructs output is different to GeoGebra's output. Usually i can use functions from GeoGebra without prolems, but i never used sin() before so i guess there might be a syntax problem. Here the sine function:

GeoGebra:
g(x) = 15sin(3sin(sin(cos(x))) x / 2 + 293 / 1000 x) + 15

Construct 2:
Set "Y" to: 15*(sin((3*sin(sin(cos(X))))*(X/2)+(Seed/1000)*X))+15

When I set X to 1 Geo outputs "27.8" and Construct 2 gives "15.07"

Tell me if you need more informations or the .capx
Thanks for your help and sorry for my imperfect english (in case you recognized) Jeeses2013-08-06 11:33:09
B
6
Posts: 4
Reputation: 312

Post » Tue Aug 06, 2013 1:05 pm

I just tried your initial GeoGebra formula in the calculator that comes with windows, and got the result 15.793, which is considerably closer to the Construct 2 value you have shown than the GeoGebra one.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
126
S
29
G
73
Posts: 5,098
Reputation: 52,016

Post » Tue Aug 06, 2013 1:11 pm

hm.. 1:0 for Construct 2
B
6
Posts: 4
Reputation: 312

Post » Tue Aug 06, 2013 1:50 pm

I think it is a stupid question, but I'll ask anyway:

X was in degrees or radians? C2 uses degrees, and some math programs uses radians
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
43
S
18
G
18
Posts: 2,106
Reputation: 16,436

Post » Tue Aug 06, 2013 2:18 pm

Yes:
"It's worth remembering Construct 2 always uses degrees, never radians. If you need to enter an angle anywhere in Construct 2, it will be in degrees."
GeoGebra uses radians, is there a way to convert degrees it into radians?
B
6
Posts: 4
Reputation: 312

Post » Tue Aug 06, 2013 2:28 pm

[QUOTE=Jeeses] Yes:
"It's worth remembering Construct 2 always uses degrees, never radians. If you need to enter an angle anywhere in Construct 2, it will be in degrees."
GeoGebra uses radians, is there a way to convert degrees it into radians?[/QUOTE]

pi(rad) = 180

x*pi(rad) = x*180
x(rad) = x*180/pi
x=x(rad)*pi/180
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
43
S
18
G
18
Posts: 2,106
Reputation: 16,436

Post » Tue Aug 06, 2013 3:36 pm

Allright, I decided to base the whole function on degrees, so I can get rid of all the converting.

Thanks for your Help
B
6
Posts: 4
Reputation: 312

Post » Tue Aug 06, 2013 5:57 pm

I think there's a mistake in your translation of the original formula where it says:

293 / 1000 x

which I think means

Seed / (1000 * x)

Your expression says:

(Seed / 1000) * X

which is equivalent to

(X * Seed) / 1000
Scirra Founder
B
378
S
220
G
84
Posts: 23,871
Reputation: 188,207


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 7 guests