Link to the GIPHY: https://media.giphy.com/media/Y260fwyrfuoQMWdPMq/giphy.gif
© 2021, Ali Soltanian Fard Jahromi. All rights reserved.
By: Ali Soltanian Fard Jahromi
What are the Trigonometric Functions?
The trigonometric functions are a set of functions which show the relation between an angle of a right-angle triangle and the ratio of the lengths of two of its sides. The trigonometric functions are: sine, cosine and tangent. The trigonometric functions are periodic, meaning that their graphs repeat continuously in a specific pattern. For example, here is the cosine function’s graph:
Uses of the Trig Functions in Game Programming
I am a game developer and a digital artist (CGI, 3D animation, digital art). I have developed and released many games in different genres. Trigonometric functions can come particularly useful in game programming. For example, in some games, I have to find a way to implement a day and night system, where the world oscillates between day and night repeatedly as the game progresses. This repetitive pattern can be represented by the cosine trigonometric function. The cosine function always results in a number between negative one and one. In the code for my game, I have a value which represents the brightness of the atmosphere of the environment which can be anywhere from zero to one. To achieve the day and night cycle, I create a variable that is constantly increasing. I then take the cosine of it. Furthermore, I take the absolute value of that variable so that the value of the variable is never below zero. The figure below is a model representing the day and night cycle implemented in the game:
The result is a trigonometric function representing the day and night cycle in my game program.
Developed by: Ali Soltanian Fard Jahromi
Download on Steam: https://store.steampowered.com/app/1639190/Cuboid_Bouncer/
Download on Google Play: https://play.google.com/store/apps/details?id=com.SoltanianGames.CuboidBouncer
Download on Microsoft Store: https://www.microsoft.com/store/productId/9N3ZQLMB2PRR
Cuboid Bouncer is a 3D Side-Scroller video game that includes 12 levels with different challenges on each level. The player is called Cuboid (a cube like character) that must jump or bounce its way through the different obstacles. Each higher level is more challenging and difficult than the previous level. There are power-ups available that can make Cuboid jump higher or move faster. To successfully complete each level the player must successfully go to the end of the level without falling. To finish the game, the player must complete all 12 levels.
Made in 24 hours for the birthday of my sister Fatimah Soltanian Fard Jahromi.
(C) 2021, Ali Soltanian Fard Jahromi. All rights reserved.
Published by: Soltanian Games