|
After studying the code, i think i might be able to do the following. Please help to validate whether it is workable.
1. Looks to me track is just a bunch of connected bezier patches. Using TRACK::GetLapSequence (Car::GetSector()) I should be able to get the current patch the car is on. And TRACK::GetLapSequence (Car::GetSector()+1) should give me the next patch.
<edit>Ok. My understanding of GetLapSequence() is wrong. I need a way to get the patch the car is currently on, and the next patch on the road. Can you provide such functions, Joe?
2. I can get the center position of the next patch using BEZIER::SurfCoord(0.5,0.5).
3. I can get the current position and orientation of the car chassis by doing Car::chassis().position(), and Car::chassis().orientation().
<edit> One more question here, does 1st column of the orientation matrix contains a vector pointing in the car's forward direction?
4. The steering goal of the AI driver will be to steer the car towards the center of the next patch. So the desired orientation should be along the vector formed by (center of next patch - current chasis position).
5. The steering command can be calculated base on the angle difference between current orientation and desired orientation.
|