Found a bug with the offroad vehicle code. The problem appears when vehicle node is destroyed, raycast vehicle is not removed from the physics world and in the next physics step update application crashes.
To fix this you need to change
RaycastVehicle::~RaycastVehicle()
{
if (sphShape_)
{
delete sphShape_;
sphShape_ = NULL;
}
if (vehicleRaycaster_)
{
delete vehicleRaycaster_;
vehicleRaycaster_ = NULL;
}
if (raycastVehicle_)
{
delete raycastVehicle_;
raycastVehicle_ = NULL;
}
}
to
RaycastVehicle::~RaycastVehicle()
{
if (sphShape_)
{
delete sphShape_;
sphShape_ = NULL;
}
if (vehicleRaycaster_)
{
delete vehicleRaycaster_;
vehicleRaycaster_ = NULL;
}
if (raycastVehicle_)
{
btDynamicsWorld *pbtDynWorld = (btDynamicsWorld*)GetPhysicsWorld()->GetWorld();
pbtDynWorld->removeVehicle(raycastVehicle_);
delete raycastVehicle_;
raycastVehicle_ = NULL;
}
}