Jump to content
  • Advertisement
Sign in to follow this  
nerco666

Rotating Counter Clockwise

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

If you intended to correct an error in the post then please contact us.

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
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?

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!