![]() |
Understanding and using sin()
First and foremost: I hate maths. This hatred has been bred into me from an early age.
But I realise how important it is in game programming. So I want to understand =) I want to make a sine wave in Graal. I would like to be able to put in a value for it's amplitude, it's frequency and the time it takes to complete a cycle. Could someone be so awesome as to explain how this works to me using sin? Hopefully I'll be able to incorporate it into graal =) |
http://i49.tinypic.com/izon4y.png
I'm horrible at math as well, but sin and cos map out the vertical and horizontal placement, respectively, of an angle(θ), as the picture demonstrates(ignore all the extra stuff, as just the blue and red lines are important). Now you just wait until someone good at math comes and rips my post apart. Just remember, gscript uses radians(0-pi*2) instead of degrees(0-360): PHP Code:
|
You've taken trigonometri in a math class before?
|
Here's a nifty little block sine wave.
PHP Code:
|
One of my friends just gave me this explanation
"if y = sinX amp = 1 period = 2π or 180ยบ if y = msin(bX) m changes the amplitude b changes the period" That could work =D |
You could also think about it like Sin is the Y movement of an angle, and Cos is the X movement of an angle, I guess. That's it's most popular use on Graal, probably.
|
Ended up with,
PHP Code:
End result is on Litheria above a sign =D |
im in grade 6
|
Do not worry about hating maths, I was playing around with sin and cos before ever taking a trigonometry class and then was immediately disappointed that it did not turn out to be very useful for my custom movement system.
|
Quote:
I was quick to understand and pick up concepts in high school but my overwhelming hatred made it horrible and my brain didn't let me retain it.... the original issues causing this have calmed down...so hopefully I can do it now :cool: |
I hate matrixes, but they're easy enough. Although they don't use sin and cos in matrix math in high school algebra. Sin and Cos are used most frequently for finding information about a triangle or a circle.
Wikipedia is a big help too, ya know ;) |
| All times are GMT +2. The time now is 03:43 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.