Sweet, Ron. Thanks! I'd changed several other setTransitions in the file (I've added several different camera angles), but hadn't seen that one at the bottom (because I'd added so many).
And I agree, the cars behave much more realistically with this new script.
Can I ask you to take a look at something else, too? I've got it worked out so that my camera can look left and right with the mouse from the first-person driver's point of view. It can also look down and as far up as level, but I can't get it to look up. I'm sure it's something to do with the camDir and pitchAngle, but I'm not sure what.
float vehicleAngle = lastVehicleAngle;
if (object.GetInterpMatrix().YAxis.y > 0.005)
{
float zy = object.GetInterpMatrix().ZAxis.y;
if (zy > -0.99 && zy < 0.99)
{
vehicleAngle = atan2( -object.GetInterpMatrix().ZAxis.x, -object.GetInterpMatrix().ZAxis.z);
lastVehicleAngle = vehicleAngle;
}
}
if (cameraAngle > vehicleAngle + 180)
cameraAngle -= 360;
if (cameraAngle < vehicleAngle - 180)
cameraAngle += 360;
cameraAngle += (vehicleAngle - cameraAngle) * 0.1;
Vector focus = object.GetInterpMatrix().T + CAMERA_TARGET;
Matrix mtx;
mtx.SetRotate( cameraAngle + headingAngle, 0, 0);
Vector camDir = mtx.ZAxis; // * cos( pitchAngle);
camDir.y -= sin( pitchAngle);
Vector cameraPos = (object.GetInterpMatrix().Project( 0.25, 1.3f, -0.7));
camera.SetFocus(cameraPos + camDir); //mtx.ZAxis);
camera.SetPosition(cameraPos);
camera.SetUp( 0, 1, 0);
camera.SetTransition( 0.0);
Oh, one more thing I'll be looking at soon but if you happen to see while you're messing around with the script I'd be grateful for - the car, if on any angle at all, will roll even if you're not in it. Do you see how to put it in "park" if you're not in it or once you've slowed to a certain speed?
Thanks.