Rotating Counter Clockwise

This topic is 3145 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

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

Share on other sites
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?

Share on other sites
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.

Share on other sites
You can rotate the other direction by negating the angle c.

Does that help at all?

Share on other sites
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

Share on other sites
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.

Share on other sites
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.

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5

• 10
• 16
• 14
• 9
• 9
• Forum Statistics

• Total Topics
632928
• Total Posts
3009270
• Who's Online (See full list)

There are no registered users currently online

×