Turret Turning for shortest arc

Started by Sorrontis, June 06, 2016, 12:11:25 AM

Previous topic - Next topic

Sorrontis

Hi, I'm having trouble making a turret aim turn the shortest direction.

I can make it aim at the right angle, but sometimes, it takes the longest angular route. I work in radians (from 0 to 6.27 rads [6.28 goes back to 0]) , and I have 2 points I give my turret; the original angle and the target angle.

The turret starts by aiming due Right (0 Rad), but keeps its position from the previous firing step.


Essentially, I want it do the what the Bertha does.
"If you want others to be happy, practice compassion. If you want to be happy, practice compassion."

planetfall

Pretty sure I'm supposed to be banned, someone might want to get on that.

Quote from: GoodMorning on December 01, 2016, 05:58:30 PM"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.

Sorrontis

Well that works... And it's a little humiliating. I've been working on this for over 2 hours. Although, I think I figured the long way to do it too :)
"If you want others to be happy, practice compassion. If you want to be happy, practice compassion."

Grayzzur

On the bright side... it's a problem that presents itself often enough to warrant the solution be handed to you in this way. :)
"Fate. It protects fools, little children, and ships named 'Enterprise.'" -William T. Riker

Sorrontis

"If you want others to be happy, practice compassion. If you want to be happy, practice compassion."