You ended that sentence with a preposition...Bastard!
Do you not see "-1" in your picture? We don't use -cos(), it's that cos itself is negative.
that was why I asking if maybe that -1 was relevant....
I was looking for a site to see if it could explain further
I found this:
Quadrant trigonometry facts
all positive from 0-90 on the first quadrant...
and since the ships heading on the first picture is 90 degrees (the arrow is at 12 o'clock) ..sin and cos are positive..yeah?
so why -cos(angle)..it doesn't make sense unless we're reading from 90-180 degrees (12 to 9 o'clock) then cos is -
if so at which point do we decide we are at 12-9 instead of 3-12 when the arrow is facing at 12 o'clock?
But I think I'm close to understanding this...
You ended that sentence with a preposition...Bastard!
yep, that you did but then I didn't know about the quadrant's rule my bad .
What I mean is since 0 to 90 is +cosWell, it really doesn't matter. Both give the same result, but i'm not sure i understood your question...
and 90 to 180 is -cos
how do I know which of the rule to choose from if it is 90 degrees on the dot?
You ended that sentence with a preposition...Bastard!
Yes, as I said, it doesn't matter because both yield the same result. cos90 is 0.
Devoted my life to programming...
unless the answer is if the angle is exactly on the dot..if the arrow is pointing straight at 90 we cannot know if it is positive or negative cos..we can only try the one or the other...and whichever works tells us which quadrant in the unit circle we're dealing with.
You ended that sentence with a preposition...Bastard!
Nononono...
Look, for your first sprite:
velX = cos(angle)
velY = sin(angle)
And for your second sprite:
velX = sin(angle)
velY = -cos(angle)
That's all there is to is!
Devoted my life to programming...
aaah, but why for the 2nd one especially?
Ok what if the ship was facing 180 degrees? (will check it now)
You ended that sentence with a preposition...Bastard!
lol I tried the formula
x = -Math.cos(angle)
y = -Math.sin(angle)
for 180 degrees
it worked perfectly for the up why is it not working when going down?..trig is beautiful and confusing as hell..I wish I understood it in secondary school :O
EDIT:
it worked with that formula..was editing the wrong file..nifty stuff..
Thanks lads..gave me a good trig lesson ha ha..sorry I was slow
Last edited by Eman; 06-01-2011 at 10:58 AM.
You ended that sentence with a preposition...Bastard!