Angle A is a Euler angle that keeps increasing by increments and Angle B is the stopping point of Angle A (think 'Spin-the-bottle' where Angle A is the current angle of the bottle Angle B is the angle needed to point to your crush and the bottle spins at a fixed rate clock-wise). To do this, I've been trying to compare Angle A and Angle B with inequalities. If Angle A is 60 degrees and Angle B is 80 degrees, this is no problem. If Angle A is 350 degrees and Angle B is 10 degrees however, the inequality thinks that Angle A has crossed Angle B even though it hasn't. How do I compare angles when they wraparound at 360 degrees?
This is some pseudocode for what I have so far:
int AngleB = 30;
int AngleA = 300;
void Update() {
AngleA += 13;
if (AngleA > AngleB) {
AngleA = AngleB;
}
}
Aucun commentaire:
Enregistrer un commentaire