• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Hyperbolic functions in gml

M

Misty

Guest
Basically, im trying to make a smooth ramp shape from a function.

Tanh is the normal way to do it but it ain't there.

Either I need a way to use tanh, (hyperbolic tangent) or else can someone please give me an equation that will produce a similar shape to the following equation
Y=-tanh(sqrt(x*pi)-pi)^2+1
 
J

Jordan Robinson

Guest
Since you are working with reasonably advanced formulas, I am guessing you're quite good at math so I can point you in the direction of this:

tanh(x) = sinh(x) / cosh(x) = (e^x - e^-x) / (e^x + e^-x)

For using Euler's number (e), check out this.

Hopefully from that, you will be able to work it out. If not, let me know.
 
Last edited by a moderator:
M

Misty

Guest
Thanks, that's exactly what I wanted. I am going to test this and see if it works using a blank game (I always use a blank game to test new things.)

Function appears to work. (I used power the "^" operator appears to not do as intended.)
 
Last edited:
J

Jordan Robinson

Guest
The function you want for Euler's number is exp(x)
 
Top