![]() |
Sin and cos functions wrong?
I've been doing an angle-based movement project, and haven't really done anything major with angles in GScript until now.
When I use a variable which is equal to 180 and take the sine of it using sin(), instead of echoing 0 for the sine value of 180 (which I know it should), it echoes a value of -0.801. The same goes for the cosine value of 180. It echoes a value of -0.598 instead of -1. Any reason for this, or is there something wrong with the functions? |
Use radian values, not degrees. pi is a built-in variable that'll help a lot.
|
There's also:
degtorad(angle); radtodeg(angle); To convert back and forth. You really shouldn't need to do that though. |
Quote:
I just feel more comfortable using degrees than radian values. |
Quote:
Keep in mind that pi is equal to a 180 degrees and it's easy enough to calculate degrees using it. I.e: 360 (pi * 2) or 90 (pi / 2) or 45 (pi / 4) and so on. |
Quote:
--This is coming from an unknowledgeable person in regards to scripting-- |
Quote:
I don't really know what you mean by "units associated with degrees" but that sounds like a silly reason to use radians. |
Quote:
"___ degrees/hour" Which doesn't make sense (if we're talking angular calculus). That's why Radians is the preferable mode in calculus. There are no units. |
Quote:
|
Quote:
|
All times are GMT +2. The time now is 09:18 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.