You've probably stumbled across my AIRS project thread by now, but now I need some help, and I figured it would be best to isolate it for others. I've searched up and down, and found several posts including the OutSimPack that I am trying to handle. I have many questions that I have yet to find documented anywhere.
Accel I had an assumption based on the lack of documentation that this would provide numbers in terms of acceleration in Gs. So if I got
Accel.x = 0.5; Accel.y = 0.2; Accel.z = 0.0;
it would mean the car is turning to the left and accelerating. Or something along those lines. However, the range is not 1 = 1G of acceleration. I have no idea what the scale is, but I simply divided by 9.81 and it still seems to work, but I'd like to confirm this fact somewhere.
The more important issue is the numbers seem to be in world space, so with the numbers provided above, it could actually mean the car is accelerating very hard and turning a little. I tried to convert this into car space, and have so far had no luck. I'm looking to get the seat of the pants feeling for the ai driver.
Any one have more information on this?
Image of issue
Notice the G force gauge in LFS shows 0.67g forward and 0.01g left. Yet my display shows more left than forward.
Accel I had an assumption based on the lack of documentation that this would provide numbers in terms of acceleration in Gs. So if I got
Accel.x = 0.5; Accel.y = 0.2; Accel.z = 0.0;
it would mean the car is turning to the left and accelerating. Or something along those lines. However, the range is not 1 = 1G of acceleration. I have no idea what the scale is, but I simply divided by 9.81 and it still seems to work, but I'd like to confirm this fact somewhere.
The more important issue is the numbers seem to be in world space, so with the numbers provided above, it could actually mean the car is accelerating very hard and turning a little. I tried to convert this into car space, and have so far had no luck. I'm looking to get the seat of the pants feeling for the ai driver.
Any one have more information on this?
Image of issue
Notice the G force gauge in LFS shows 0.67g forward and 0.01g left. Yet my display shows more left than forward.
const OutSimPack& msg(InterpretAs<OutSimPack>(data, dataLength)); //msg is the OutSimPack
const float kOneGravity(9.81f);
GameMath::Vector3 carDirection(LiveForSpeed::ConvertHeadingToForward(msg.Heading));
GameMath::Vector3 carUp(LiveForSpeed::ConvertPitchToUp(msg.Pitch));
GameMath::Vector3 carRight(carDirection ^ carUp); //Vector Cross Product
//Note the y/z is swapped on purpose. In my 'world' Y is up and Z is forward.
//The drawing code ignores the vertical acceleration, using only forward and right.
GameMath::Vector3 carAcceleration(msg.Accel.x / kOneGravity, msg.Accel.z / kOneGravity, msg.Accel.y / kOneGravity);
GameMath::Vector3 carSpaceAcceleration(carAcceleration * carRight, carAcceleration * carUp, carAcceleration * carDirection);
lfsScanner->SetCarAcceleration(driverCarIndex, carSpaceAcceleration);
GameMath::Vector3 LiveForSpeed::ConvertHeadingToForward(const float lfsHeading)
{ //angle 0 = 0* = (0,0,1) lfs = anticlockwise from above (Z)
float angleInRadians = GameMath::Convert::DegreesToRadians((lfsHeading));
GameMath::Vector3 forward(sin(angleInRadians), 0.0f, cos(angleInRadians));
GameMath::Vector3Normalize(&forward, &forward);
return forward;
}
GameMath::Vector3 LiveForSpeed::ConvertPitchToUp(const float lfsPitch)
{ //angle 0 = 0* = (0,1,0) anticlockwise from right (X)
float angleInRadians = GameMath::Convert::DegreesToRadians((lfsPitch));
GameMath::Vector3 up(0.0f, cos(angleInRadians), sin(angleInRadians));
GameMath::Vector3Normalize(&up, &up);
return up;
}