MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Setup

Method Setup

Source/Engine/Physics/Actors/WheeledVehicle.cpp:341–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341void 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

Callers

nothing calls this directly

Calls 3

GetPhysicsSceneFunction · 0.85
GetPhysicsSceneMethod · 0.80
ClearMethod · 0.45

Tested by

no test coverage detected