Sign in to follow this  
nerco666

Rotating Counter Clockwise

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this