Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7071443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:41:18+00:00 2026-05-28T05:41:18+00:00

This is what I have I have a plane in 2D X,Y I set

  • 0

This is what I have

  • I have a plane in 2D X,Y
  • I set his destination by clicking on the screen X’, Y’
  • I calculate the angle it needs to turn to face this destination with:
// Calculate the angle between plane position and destination point

CVector3 facingVec = m_vDestination - m_vPosition;
fAngle = -Math::radiansToDegrees (  (float)atan2f(m_vDestination.x - m_vPosition.x, m_vDestination.y - m_vPosition.y)  )  ;

//This doesn't work, when rotating from ex. 350 degree to 0 
//plane has to go all the way around 360,350,340,330,
//...,120,...100,90,..down to zero
float angleToTurn = fAngle - m_fRotationAngle;
if(angleToTurn < 0)
{
    angleToTurn += 360.0f;
}

m_fRotationAngle += (angleToTurn) / 5;

// Move the unit towards the calculated angle m_fRotationAngle

m_vDirection.x =   (-sin(Math::degreesToRadians(m_fRotationAngle)));
m_vDirection.y =   (cos(Math::degreesToRadians(m_fRotationAngle)));

m_vPosition += ( 2 * m_vDirection * fDelta);

This is how it looks like

YT Video – sorry for the demo version, i couldn’t get anything free at this moment.

This is what I need

  • I need this to behave properly, let’s say plane is rotated at angle 350.
    I set the destination and new angle should be 15.

Instead of going: 350,340,330,320,310,300,290,…10,0,15
It should continue: 350,0,15

Hope you can help me out with this guys, I’ve already dropped bezier approach – and I’m struggling with this since few days now.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:41:19+00:00Added an answer on May 28, 2026 at 5:41 am

    If I read this correctly, you’re trying to find the smallest angle to interpolate between the two vectors? If so, the following algorithm should work:

    1. Find the angle of the first vector, relative to the fixed vector [1, 0]. This is a1.
    2. Find the angle of the second vector, relative to the fixed vector [1, 0]. This is a2.
    3. Let da = a2 – a1.
    4. if da > 180, da -= 360;
    5. else if da < 180, da += 360;

    You need to calculate the angles with respect to another third vector [1, 0] so you can determine weather to rotate left or right.

    Edit: I saw your YouTube link was broken, now I see it’s working again. I think my answer is what you’re after.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I have this algorithm to calculate cross-section of 3D shape with plane given
I have a set of point (x,y) on a 2d plane. Given a point
I have a set of points on the infinite (well, double precision) 2D plane.
This problem is a kind of closest pair between two disjoint set. Upperside picture
I have this need to place my app in the share/send context menu so
I want to draw image in place where I click. i have this code:
This has been driving me crazy. I think I have everything in place but
I have an website where people can place a vote like this: http://mysite.com/vote/25 This
I have code that all over the place(probably 20-30 instances) does this: <widget>.setVisible((condition ==
I keep getting this error all over the place where I only have jquery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.