For a very simple way to remember right triangle trig, just remember the phrase "SOHCAHTOA" (s=o/h, c=a/h, t=o/a), where s is sine, c is cosine, and t is tangent. O stands for opposite (opposite side or angle), h stands for hypotenuse, and a stands for adjacent (side length). To do any of this, you need to have 3 things defined. You need to have the unknown (SCT) and 2 knowns (OAH). Just solve it like any basic algebraic equation then! By the way, if you are solving for certain values using this, you might need a trig table. Or if you have a graphing calculator, just input the problem in, and it will solve it for you.
Offline
Cyclone103 wrote:
For a very simple way to remember right triangle trig, just remember the phrase "SOHCAHTOA" (s=o/h, c=a/h, t=o/a), where s is sine, c is cosine, and t is tangent. O stands for opposite (opposite side or angle), h stands for hypotenuse, and a stands for adjacent (side length). To do any of this, you need to have 3 things defined. You need to have the unknown (SCT) and 2 knowns (OAH). Just solve it like any basic algebraic equation then! By the way, if you are solving for certain values using this, you might need a trig table. Or if you have a graphing calculator, just input the problem in, and it will solve it for you.
My teacher told me about SOHCAHTOA too
Offline
Same here.
Offline
SOHCAHTOA was the only way that I was able to remember right triangle trig. I probably never would have remembered it otherwise (^_^)
Offline
I know. I missed the lesson because I was sick and I had to retake the test because I got a 30 on it. Luckly, I had an awsome math teacher.
Offline
lol my teacher was so good, that when I missed 9 days of school, the unit test was right after that and I had missed some pretty important stuff, but then I aced the test
Offline
Hm... after reading the lesson that Archmage gave several times, I sort of understand Sine, Cosine and Tangent. One thing I do NOT get, however, is how to use it in a game. Paddle2See's explanation didn't really help, I thought trigonometry was for right triangles? I don't see how exactly it works in a game, though I do see the effect of it. Wait... I somewhat understand. Could it be used for determining velocities for sprites that change direction, but still keep going in the direction they were thrust in after turning? Also...
dingdong wrote:
I'm probably the youngest "good" scratcher on this website, oh yeah I learned scrolling in steps from you, so thanx
No need to brag, dingdong. For all we know, there could be a genious three-year-old Scratcher better than Paddle2See out there. So never assume you're the best of your age, never think you're better than anyone else. We're all the best in our own special way.
Offline
coolstuff wrote:
Hm... after reading the lesson that Archmage gave several times, I sort of understand Sine, Cosine and Tangent. One thing I do NOT get, however, is how to use it in a game. Paddle2See's explanation didn't really help, I thought trigonometry was for right triangles? I don't see how exactly it works in a game, though I do see the effect of it. Wait... I somewhat understand. Could it be used for determining velocities for sprites that change direction, but still keep going in the direction they were thrust in after turning? Also...
dingdong wrote:
I'm probably the youngest "good" scratcher on this website, oh yeah I learned scrolling in steps from you, so thanx
No need to brag, dingdong. For all we know, there could be a genious three-year-old Scratcher better than Paddle2See out there. So never assume you're the best of your age, never think you're better than anyone else. We're all the best in our own special way.
We already talked about this coolstuff on a different post. Remember?
Offline
piplupquaza wrote:
dingdong wrote:
I'm probably the youngest "good" scratcher on this website, oh yeah I learned scrolling in steps from you, so thanx
How old are u then? just wondering PS im 11<next costume>
dingdong is 13
Offline
Archmage: That's a good explanation. I don't know trig, but my sister Robin7 (she's 13, and going into 9th grade, because she skipped a grade) does know some.
Offline
Bluestribute wrote:
coolstuff wrote:
Hm... after reading the lesson that Archmage gave several times, I sort of understand Sine, Cosine and Tangent. One thing I do NOT get, however, is how to use it in a game. Paddle2See's explanation didn't really help, I thought trigonometry was for right triangles? I don't see how exactly it works in a game, though I do see the effect of it. Wait... I somewhat understand. Could it be used for determining velocities for sprites that change direction, but still keep going in the direction they were thrust in after turning? Also...
dingdong wrote:
I'm probably the youngest "good" scratcher on this website, oh yeah I learned scrolling in steps from you, so thanx
No need to brag, dingdong. For all we know, there could be a genious three-year-old Scratcher better than Paddle2See out there. So never assume you're the best of your age, never think you're better than anyone else. We're all the best in our own special way.
We already talked about this coolstuff on a different post. Remember?
no...
And if you mean by Paddle2See's explanation, I said that I didn't quite get that.
Offline
I've just started messing about with this stuff (with the usual aim of making a nice Asteroids style space ship, with vectored thrust), but I have to admit my maths is bloomin' awful I was never very good at it at school, and that was a long time ago too... so this is a bit of a struggle for me!
I got the computation to work in a spreadsheet... I think. I have two questions:
1) Taking Y axis thrust as an example, my expected results were: for direction 0, I should get, say, 10 units of thrust. For direction 90 I should get 0 thrust, for -180 I should get -10. My current algorithm returns those figures.
But I also expected to get 5 for direction 45. But I don't. I get 5 for direction 30 (or was it 60?). Is that right? Or have I messed up the algorithm?
(I'll post my algorithm when I get home, I can't remember exactly what it is)
edit: just worked it out...
where col A contains the angle, and D1 is =SUM(3.14159265/180) (for radian conversion)
=SUM(SIN(A1*D1))
2) When I apply it to my Scratch project, it seems the engine is resorting to integers somewhere in the calculation, as I only seem to get thrust values of zero or 10 Obviously I could just have messed up the calculation, but are there any problems with precision / rounding I should be aware of?
cheers
Last edited by SonicPopsDad (2008-08-04 10:24:06)
Offline
SonicPopsDad wrote:
I've just started messing about with this stuff (with the usual aim of making a nice Asteroids style space ship, with vectored thrust), but I have to admit my maths is bloomin' awful I was never very good at it at school, and that was a long time ago too... so this is a bit of a struggle for me!
I got the computation to work in a spreadsheet... I think. I have two questions:
1) Taking Y axis thrust as an example, my expected results were: for direction 0, I should get, say, 10 units of thrust. For direction 90 I should get 0 thrust, for -180 I should get -10. My current algorithm returns those figures.
But I also expected to get 5 for direction 45. But I don't. I get 5 for direction 30 (or was it 60?). Is that right? Or have I messed up the algorithm?
(I'll post my algorithm when I get home, I can't remember exactly what it is)
edit: just worked it out...
where col A contains the angle, and D1 is =SUM(3.14159265/180) (for radian conversion)
=SUM(SIN(A1*D1))
2) When I apply it to my Scratch project, it seems the engine is resorting to integers somewhere in the calculation, as I only seem to get thrust values of zero or 10 Obviously I could just have messed up the calculation, but are there any problems with precision / rounding I should be aware of?
cheers
Okay...a couple of things. If you are getting 10 units of thrust at zero degrees, you should be getting -10 units at 180 degrees and -180 degrees (both are the same direction). You should be using an expression similar to:
Y_thrust = 10 * Cos(direction)
X_thrust = 10 * Sin(direction)
At 45 degrees, you should be getting about 7.07 units for both Y_thrust and X_thrust. Remember that the pythagorian formula is used to get the total magnitude of a vector from it's components so the square root of (7.07^2 + 7.07^2) = 10. At 60 degrees you should be getting 5 units.
There is no need to mess around with radians, all the Scratch functions work in degrees. You should not be getting round-off but you may find that the Say function will only report values to the nearest tenth. The precision is still kept internally. Hope that helps!
Offline
Thanks Paddle2see, for the purposes of my example I'd ignored direction, but hadn't in my Scratch code. But I hadn't really thought it through and so I think your maths makes for a much more elegant answer to the problem than I'd written so far!
Offline
SonicPopsDad wrote:
Thanks Paddle2see, for the purposes of my example I'd ignored direction, but hadn't in my Scratch code. But I hadn't really thought it through and so I think your maths makes for a much more elegant answer to the problem than I'd written so far!
No problem. Always eager to help another Asteroids fan! I have a gallery of Asteroid games if you want to see what others have done. Of course, sometimes its more fun just to do it yourself!
Offline
No problem. Always eager to help another Asteroids fan! I have a gallery of Asteroid games if you want to see what others have done. Of course, sometimes its more fun just to do it yourself!
I've seen there are a few Asteroid games, so I'm trying to make Space Castle!
And yes, I'm trying to work it out *mostly* for myself. At work of course we eschew 'reinventing the wheel' to save time, but here it's really the intellectual exercise that makes it really worthwhile
Having said that, I also started to work out a method of doing scrolling, got a bit bogged down and so took a look at Archmage's method. His method coincides closely to my attempt, but he's already worked out the bugs... I'm going to use his code. I think the same may occur with the Asteroids ship!
edit: Actually it wasn't too tricky... and quite fun fiddling the scaling figures on the thrust vectors to get the right 'feel' to the spaceship movement. I've still got some gameplay tweaks to do, but it's nearly in a shareable form Oh, and you may know the game as 'Star Castle' not Space Castle
Last edited by SonicPopsDad (2008-08-05 11:47:54)
Offline
dingdong wrote:
I'm probably the youngest "good" scratcher on this website, oh yeah I learned scrolling in steps from you, so thanx
What's that supposed to mean?
I'm 12, and that means I'm younger than you. So you're saying that everyone younger than you isn't good at Scratch? At least I'm not the one asking how to use the trig functions XP
Offline
Jello715 wrote:
dingdong wrote:
I'm probably the youngest "good" scratcher on this website, oh yeah I learned scrolling in steps from you, so thanx
What's that supposed to mean?
I'm 12, and that means I'm younger than you. So you're saying that everyone younger than you isn't good at Scratch? At least I'm not the one asking how to use the trig functions XP
I think that Dingdong's ego just got the best of him
Programming skill is also very dependent on age as well. Older scratchers will have a much easier time creating things. If you can create anything at 12 years old then I would say that you are good
Last edited by archmage (2009-01-18 17:32:54)
Offline
dingdong wrote:
I'm probably the youngest "good" scratcher on this website, oh yeah I learned scrolling in steps from you, so thanx
were the same age, and I consider myself a "good" scratcher also, but there are younger scratchers who could out game me.
Offline
dingdong wrote:
I'm probably the youngest "good" scratcher on this website, oh yeah I learned scrolling in steps from you, so thanx
Hey, I'm 13 and I am a great scratcher
Offline
hmmm, i recently did this in maths, so ill explain how i learnt it.
we use SOHCAHTOA.
break down is this:
SOH: Sin Opposite/hypotenuse
CAH: Cosin Adjacent/hypotenuse
TOA: Tan Opposite/adjacent.
Lets say you wanted to work out what X is.
the adjacent is ALWAYS the one next to it, and not the hypotenuse. The opisit is ALWAYS the one that is, well opposite it. and the hypotenuses is the longest one (opposite the right angle)
lets say the hypotenuse is 5 and B was 3. we have the hypotenuse's value and the opposite's value. This means we must use Sin, as we dont have the adjacent needed for tan or cosin. looking back at how sine looks like (SOH: Sin Opposite/hypotenuse) we know that we have to first work out the opposite divided by the hypotenuse (O&H) which is 0.6. Now we know the equation looks like this: sin 0.6. We are trying to work out the angle, so we have to use sin-1 on a calculator which gives you 36.87 aprox.
to use tan, its the same sort of thing. only (looking back at the formula) which is CAH: Cosin Adjacent/hypotenuse. assuming the adjacent is 4, and the hypotanues is the same (5) its simply cosin-1 (4/5) which is also 36.87. I might explain how to work out the length of side A or B if you have one of the three sides and one of the angle's values
Last edited by yambanshee (2009-03-20 12:33:19)
Offline
I vaguely get it, this help ossociate the spinning price with the cooridinates of another sprite while it's spinning in air! This may help me on my Interactive buddy type personage and scroller. Instead of using a buddy I'm using a robot! This is also helpful to me because I am in the midsts of making an iPone app and understanding X-code. I have a sense that trig coordinate tracking is inevitable, so thanx! XD Oh yeah, I forgot to mention, I understand and I'm in 7th Grade, part of finding out the answer is basic problem solving while the other half is a bit more high-bel math. PS: How do you make those icon/tabs at the end of every message? Thanks <move( )steps>Archmage!
Offline
Mirror27Studios wrote:
I vaguely get it, this help ossociate the spinning price with the cooridinates of another sprite while it's spinning in air! This may help me on my Interactive buddy type personage and scroller. Instead of using a buddy I'm using a robot! This is also helpful to me because I am in the midsts of making an iPone app and understanding X-code. I have a sense that trig coordinate tracking is inevitable, so thanx! XD Oh yeah, I forgot to mention, I understand and I'm in 7th Grade, part of finding out the answer is basic problem solving while the other half is a bit more high-bel math. PS: How do you make those icon/tabs at the end of every message? Thanks <move( )steps>Archmage!
Those icon tabs are called signatures. You can have one after you get 50 posts.
Offline
Here is a script I wrote to help another Scratcher:
It uses ATAN to keep Sprite1 pointing away from Sprite2:
Full sized view: http://i57.photobucket.com/albums/g228/BoltBait/PointAway.gif
Basically, it uses ATAN to convert Cartesian coordinates of Sprite2 (x,y) into polar coordinates (r, th). Then, the angle theta (th) is used to calculate the opposite angle.
This is the type of math you learn in Algebra II class.
Offline