mirror of
https://github.com/overte-org/overte.git
synced 2025-04-26 07:16:25 +02:00
fix order of angle calculations
This commit is contained in:
parent
681044e3a6
commit
37aee09968
1 changed files with 7 additions and 10 deletions
|
@ -168,23 +168,20 @@ void *sendBuffer(void *args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (absoluteAngleToSource > 180) {
|
bearingRelativeAngleToSource = absoluteAngleToSource - agentBearing;
|
||||||
absoluteAngleToSource -= 360;
|
|
||||||
} else if (absoluteAngleToSource < -180) {
|
if (bearingRelativeAngleToSource > 180) {
|
||||||
absoluteAngleToSource += 360;
|
bearingRelativeAngleToSource -= 360;
|
||||||
|
} else if (bearingRelativeAngleToSource < -180) {
|
||||||
|
bearingRelativeAngleToSource += 360;
|
||||||
}
|
}
|
||||||
|
|
||||||
bearingRelativeAngleToSource = absoluteAngleToSource - agentBearing;
|
|
||||||
bearingRelativeAngleToSource *= (M_PI / 180);
|
bearingRelativeAngleToSource *= (M_PI / 180);
|
||||||
|
|
||||||
float angleOfDelivery = absoluteAngleToSource - otherAgentBuffer->getBearing();
|
float angleOfDelivery = absoluteAngleToSource - otherAgentBuffer->getBearing();
|
||||||
|
|
||||||
if (angleOfDelivery < -180) {
|
|
||||||
angleOfDelivery += 360;
|
|
||||||
}
|
|
||||||
|
|
||||||
float offAxisCoefficient = MAX_OFF_AXIS_ATTENUATION +
|
float offAxisCoefficient = MAX_OFF_AXIS_ATTENUATION +
|
||||||
(OFF_AXIS_ATTENUATION_FORMULA_STEP * (fabsf(angleOfDelivery) / 90.0f));
|
(OFF_AXIS_ATTENUATION_FORMULA_STEP * (fabsf(angleOfDelivery) / 90.0f));
|
||||||
|
|
||||||
printf("AD: %f, OC: %f\n", angleOfDelivery, offAxisCoefficient);
|
printf("AD: %f, OC: %f\n", angleOfDelivery, offAxisCoefficient);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue