VPP exposes the transmission rpm, which is the rpm at the output of the gearbox. If there's a gear engaged, then multiplying by the gear ratio gives the rpm at the input of the gearbox.
The RPM at the output of the gearbox can be read from the vehicle channel in the data bus. From a custom add-on script:
float transmissionRpm = vehicle.data.Get(Channel.Vehicle, VehicleData.TransmissionRpm) / 1000.0f;
Other values in this channel can be used to check if a gear is engaged.
- The value VehicleData.GearboxShifting is zero.
- VehicleData.GearboxGear is non-zero and equals to the engaged gear number.
bool gearboxShifting = vehicle.data.Get(Channel.Vehicle, VehicleData.GearboxShifting) != 0;
int gearNumber = vehicle.data.Get(Channel.Vehicle, VehicleData.GearboxGear);
The ratio of the engaged gear can be consulted in the vehicle controller. With that, the rpm at the input of the gearbox (clutch side) can be calculated:
if (!gearboxShifting && gearNumber > 0)
{
float gearRatio = (vehicle as VPVehicleController).gearbox.forwardGearRatios[gearNumber-1];
float clutchRpm = transmissionRpm * gearRatio;
}