I did create platforms with sin function

So I did try to use what I learned from this lecture to make some platforms and it did work pretty well.

And here is code for platforms:

I was kinda surprised by how easy it was to make.


I’m so happy you got it to work :slight_smile: Keep it up and it will only get easier.

Great work @Mikapo. Using sin waves for platforms is a classic!
Now you know how to construct them you’ll be finding a million an one places to use them in your games.

Hello Gary and Team,

Thank you for this math course. I have also applied the sine wave principle to my test project. I have a question regarding the code implementation: should we also be mindful of DeltaTime in our Sin function, since the FPS count varies from one PC to another? If so, where should we put it?

In my implementation, I use the sin function to create an offset and then add that to the new location. I believe if you multiply this offset with DeltaTime it will be FPS independent.

1 Like

I was stuck on this for a while but this is what I came up with…What tripped me up is that I was getting the platform position on tick so when I would update the Amplitude and Frequency they would give me undesired results. Ex. I increased the Amplitude but then the platform wouldn’t reach the desired position. Also I totally forgot that we needed to throw in a constant updating value in our sine.

1 Like