Rotating Counter Clockwise

Started by
5 comments, last by nerco666 14 years, 1 month ago
I am making a game Radar Hud, but I have run into a problem. I rotate clockwise instead of counter clockwise. Could someone point me into the right direction of how to solve my problem. Thanks, N
Advertisement
Quote:I am making a game Radar Hud, but I have run into a problem. I rotate clockwise instead of counter clockwise. Could someone point me into the right direction of how to solve my problem.
We'll probably need some more info; rotating clockwise instead of counterclockwise is trivial (just rotate the other way), so I'm guessing there's more going on here than is evident from your post.

Can you describe the problem in more detail?
Here is my rotation code.

ab[0] and ab[1] is the difference between a and b (a - b)

abc[0] = ab[0] * cos(c) - ab[1] * sin(c);
abc[1] = ab[0] * sin(c) + ab[1] * cos(c);


I hope this helps you help m.

EDIT: I found out if I negate Cosine it will rotate counter clockwise, but I want to find a more "conventional" way of rotating counter clockwise.
You can rotate the other direction by negating the angle c.

Does that help at all?
Sorry, but that still did not fix my problem. What if I tried something like this..


if (abc[0] > 0)
{
abc[0] -= 360;
}
else if (abc[0] < 0)
{
abc[0] += 360;
}

if (abc[1] > 0)
{
abc[1] -= 360;
}
else if (abc[1] < 0)
{
abc[1] += 360;
}

Thanks,

N
Earlier you were treating abc as a vector, but in the above example you seem to be treating it as a pair of angles...?

In any case, I'm afraid I don't really understand the problem that you're trying to solve. If you could explain the problem in more detail, it might make it easier for us to offer suggestions as to how to solve it.
I fixed my problem! To make my rotation go counter clockwise I negated Cosine which gets the job done :).


r[0] = (-cos(t) * d[0] - sin(t) * d[1]) / 36;
r[1] = (sin(t) * d[0] + -cos(t) * d[1]) / 36;

I changed the variable names a bit, but does the same thing.

This topic is closed to new replies.

Advertisement