Sine Functions in Construct 2

  • 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)

  • 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.

  • hm.. 1:0 for Construct 2

  • 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

  • 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?

  • 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?

    pi(rad) = 180?

    x*pi(rad) = x*180?

    x(rad) = x?*180/pi

    x?=x(rad)*pi/180

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

    Thanks for your Help

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)