Update simplix
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5556 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: f59435efaa97ed9b5755d06feddf8afdeb04bea2 Former-commit-id: 75dd3e38064c892072f74a16f95b6663c81e387d
This commit is contained in:
parent
38115bf20e
commit
b3e990451c
1 changed files with 21 additions and 4 deletions
|
@ -93,16 +93,33 @@ double TCollision::AvoidTo
|
||||||
if (Coll.OppsAtSide) // Opponents at side?
|
if (Coll.OppsAtSide) // Opponents at side?
|
||||||
{
|
{
|
||||||
int Flags = Coll.OppsAtSide; // Get corresponding flags
|
int Flags = Coll.OppsAtSide; // Get corresponding flags
|
||||||
double Offset; // Calc target by offset
|
double Offset;
|
||||||
|
|
||||||
AvoidTo = (Flags & F_LEFT) ? 1.0 : -1.0; // Go away from opponent
|
AvoidTo = (Flags & F_LEFT) ? 1.0 : -1.0; // Go away from opponent
|
||||||
|
|
||||||
if (Flags == (F_LEFT | F_RIGHT)) // Opps on both sides?
|
if (Flags == (F_LEFT | F_RIGHT)) // Opps on both sides?
|
||||||
{ // Then use middle
|
{ // Then use middle
|
||||||
Offset = 0.5 * // Offset is an estimate
|
Offset = 0.5 * // Offset is an estimate
|
||||||
(Coll.MinRSideDist - Coll.MinLSideDist) // of where this is.
|
(Coll.MinRSideDist - Coll.MinLSideDist) // of where this is.
|
||||||
- CarToMiddle;
|
- CarToMiddle;
|
||||||
LogSimplix.debug("Go between0: %g\n",Offset);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (AvoidTo > 0)
|
||||||
|
{
|
||||||
|
double B = Coll.MinLSideDist + oCar->pub.trkPos.toRight;
|
||||||
|
double W = oCar->pub.trkPos.toLeft + oCar->pub.trkPos.toRight;
|
||||||
|
Offset = (W - B)/2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double B = Coll.MinRSideDist + oCar->pub.trkPos.toLeft;
|
||||||
|
double W = oCar->pub.trkPos.toLeft + oCar->pub.trkPos.toRight;
|
||||||
|
Offset = -(W - B)/2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
else if (Coll.OppsAhead) // Opponents in front?
|
else if (Coll.OppsAhead) // Opponents in front?
|
||||||
{ // Choose side that has potential of overtaking the car ahead
|
{ // Choose side that has potential of overtaking the car ahead
|
||||||
if ((Coll.OppsAhead == F_LEFT) // Opponent ahead is left
|
if ((Coll.OppsAhead == F_LEFT) // Opponent ahead is left
|
||||||
|
@ -167,7 +184,7 @@ double TCollision::AvoidTo
|
||||||
|
|
||||||
return AvoidTo;
|
return AvoidTo;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
DoAvoid = true; // Avoid to side
|
DoAvoid = true; // Avoid to side
|
||||||
Offset = Me.CalcPathTarget // Use offset to
|
Offset = Me.CalcPathTarget // Use offset to
|
||||||
(DistanceFromStartLine, Offset); // find target
|
(DistanceFromStartLine, Offset); // find target
|
||||||
|
|
Loading…
Reference in a new issue