mirror of
https://github.com/Q3Rally-Team/q3rally.git
synced 2024-11-21 19:41:36 +00:00
Fix bots going in reverse for no reason in races
On some maps bots went in reverse right away or got (almost to?) the first checkpoint and then went in reverse forever. Race movement uses derivatives on a curve but they seem to be invalid at fraction 0 and 1 so limit it to 0.05 to 0.95 (arbitrary). This change fixes bots being stuck near the beginning of q3r_nightcity, q3r_ridgeracer, and q3r_valley. The bots can complete the maps now.
This commit is contained in:
parent
43101bf2f8
commit
51578c980c
1 changed files with 9 additions and 0 deletions
|
@ -3070,6 +3070,15 @@ int AINode_MoveToNextCheckpoint( bot_state_t *bs )
|
|||
|
||||
// Com_Printf( "f %f\n", f );
|
||||
|
||||
// Bot goes backward if f is 0 or 1 so limit range.
|
||||
// origin is fine but derivitives seem to be invalid.
|
||||
// --zturtleman
|
||||
if ( f > 0.95f ) {
|
||||
f = 0.95f;
|
||||
} else if ( f < 0.05f ) {
|
||||
f = 0.05f;
|
||||
}
|
||||
|
||||
G_GetPointOnCurveBetweenCheckpoints( prev, next, f, origin );
|
||||
G_Get2ndDervOnCurveBetweenCheckpoints( prev, next, f, alpha );
|
||||
G_GetDervOnCurveBetweenCheckpoints( prev, next, f, delta );
|
||||
|
|
Loading…
Reference in a new issue