![]() |
Newb Gift: Circular Movement
It seems that all the newbs seem to have problems for some reason with cos and sin. I feel it is my responsibility then to provide help and give a quick description. I know this has been covered UBER amounts of time (Maybe this'll get stickied even)
First off, Sin is the opposite angle divided by the hypotenuse. Cos is the adjacent angle divided by the hypotenuse. Perhaps Kai will be kind enough to post his chart up again ;) Using sine (sin) is generally applied to the x value. Using cosine(cos) is generally applied to the y value. When moving around persay a light or something, this is the format you would use: NPC Code: The x value gets added to the sin of the angle, then multiplied by the distance from the centre point. It isn't all that hard. Play with it a bit. Use a variable for angle and distance. Try and get things to move on a timeout or whatnot. It'll come in handy. I hope you find use for it and I explained what you did not understand. If you have any other questions, that haven't been answered in EVERY other cos/sin thread, ask away. ---Shifter |
Re: Newb Gift: Circular Movement
Quote:
x=x+sin(angle)*radius; y=y+cos(angle)*radius; |
Re: Newb Gift: Circular Movement
Quote:
|
It all deals with triangles, it isn't that hard to comprehend I think. Get in a GeoMetry class, perhaps even a lower Algebra class would be useful. If you need some equations, I can help you guys out. It just takes a bit getting used to. ANd yes, Distance is radius, but since the people seem to need help in this area, I assumed that using more mathmatical terms was unnecessary. I said it was the distance from the centre, basically the radius :D
---Shifter |
Even though the radius is diameter/2
|
Re: Newb Gift: Circular Movement
Quote:
xvalue = cos(angle) yvalue = -sin(angle) "getangle" is doing the same, so to be compatible, just follow this. |
Thats because you were treating him like a 20 year old adult, and not like a little baby ;)
EDIT!!! Shifter!!! WHAT ABOUT RADIANS?? Radian = Degree / 180 *3.142 So.... To show something at 45 degrees... to a point you would use this.angle = 45/180*3.14; x=x+sin(this.angle)*this.radius; y=y+cos(this.angle)*this.radius; |
LOL, ain't THAT the truth Kai :P It was the best way to learn, but I know it can be aggravating. Knowing THAT something works doesn't mean you understand the command. Knowing WHY something works is when you can say you comprehend it.
---Shifter |
...and who told you how to to that r0bin :P
|
Same place he learns MOST of his new tricks ;) From meh :P and j00 :D
---Shifter ;) |
JAGEN! TEH 1337EST DUDE!!!!!!!!!!!!
(Yeah people were wondering... "where did r0bin get this extensive knowledge all of a sudden?") NOT FROM YOU SHIFTER!!! Jagen taught me everything i know <3 |
WTF are you talking about bish?! WHO IM'ed ME asking to be taught cos and sin?!
---Shifter |
I did, but you taught me **** all :P
Bah i must have listened to jagen and not you :P |
I dunno, I'm feeling discredited and unloved here =/ You know I'd always help you... :(
---Shifter |
I still <3 you!! even if you dont come on aim any more :'(
|
| All times are GMT +2. The time now is 07:29 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.