Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Working out delta theta to obtain a particular angle.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 MrMark   Members   -  Reputation: 196

Like
0Likes
Like

Posted 05 June 2012 - 05:04 AM

Hi guys

I've been spending an embarrassing amount of time on a fairly simple problem. In my 2D world each entity has an orientation (theta) which represents the direction it is facing.

Given its current orientation and a target orientation, I want to find out:

The change in theta required to achieve the target orientation, rotating clockwise.
The change in theta required to acheive the target orientation, rotating counter clockwise.

the closest I got was abs(current - target) for clockwise rotations, and -abs(current - target), for counter clockwise rotations. But that falls apart when you go past 0.

This should be simple, but i can't seem to work it out.


Please help :)

Sponsor:

#2 SiCrane   Moderators   -  Reputation: 9662

Like
1Likes
Like

Posted 05 June 2012 - 07:11 AM

If I understand your question, start with delta = target - current. If you want a clockwise rotation, and delta is negative add 360 degrees to delta. If you want a counterclockwise rotation and delta is positive subtract 360 degrees.

#3 MrMark   Members   -  Reputation: 196

Like
0Likes
Like

Posted 05 June 2012 - 09:03 AM

If I understand your question, start with delta = target - current. If you want a clockwise rotation, and delta is negative add 360 degrees to delta. If you want a counterclockwise rotation and delta is positive subtract 360 degrees.


It works XD,

Thanks for your help.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS