Maths in Games – Part 1 : Trigonometry Circles

In schools, you might wonder why you learn about Sin theta, Cos theta, tan inverse, vector algebra etc because you never use them in your daily life. Well, If you are planning to be a Game Developer or WebDeveloper or Animation technical programmer or app developer (in some cases) you might need this to move things across the Computer Screen, iPad or on a Smart Phone.

Or you can visualize cool stuffs with this just for fun, to learn more about this Trigonometric functions.

Here’s the Part 1 of the Maths in Games Series. I assume you already know the basics of trigonometry. off we go.

Sin and Cos combination can be used to draw circles. From 0 to 360 degree, if we move a ball with its horizontal movement as Cos value and Vertical movement as Sine value, the ball will move in a circular motion.

In effect

ball.x = center.x + radius x cos(angle);
ball.y = center.y + radius x sin(angle);

mathingames_part1preview

See the Preview in Action

Hope it gives you an idea. Several other implementations of this will be explored in part II (Soon, I hope).

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *