| 339 | } |
| 340 | |
| 341 | void WheeledVehicle::Setup() |
| 342 | { |
| 343 | #if WITH_VEHICLE |
| 344 | if (!_actor || !IsDuringPlay()) |
| 345 | return; |
| 346 | |
| 347 | // Release previous |
| 348 | void* scene = GetPhysicsScene()->GetPhysicsScene(); |
| 349 | if (_vehicle) |
| 350 | { |
| 351 | PhysicsBackend::RemoveVehicle(scene, this); |
| 352 | PhysicsBackend::DestroyVehicle(_vehicle, (int32)_driveTypeCurrent); |
| 353 | _vehicle = nullptr; |
| 354 | } |
| 355 | |
| 356 | // Create a new one |
| 357 | _wheelsData.Clear(); |
| 358 | _vehicle = PhysicsBackend::CreateVehicle(this); |
| 359 | if (!_vehicle) |
| 360 | return; |
| 361 | _driveTypeCurrent = _driveType; |
| 362 | PhysicsBackend::AddVehicle(scene, this); |
| 363 | PhysicsBackend::SetRigidDynamicActorSolverIterationCounts(_actor, 12, 4); |
| 364 | #else |
| 365 | LOG(Fatal, "Vehicles are not supported."); |
| 366 | #endif |
| 367 | } |
| 368 | |
| 369 | #if USE_EDITOR |
| 370 |
nothing calls this directly
no test coverage detected