| 2226 | } |
| 2227 | |
| 2228 | void TerrainPatch::DestroyCollision() |
| 2229 | { |
| 2230 | PROFILE_CPU(); |
| 2231 | ScopeLock lock(_collisionLocker); |
| 2232 | ASSERT(HasCollision()); |
| 2233 | |
| 2234 | void* scene = _terrain->GetPhysicsScene()->GetPhysicsScene(); |
| 2235 | PhysicsBackend::RemoveCollider(_terrain); |
| 2236 | if (_terrain->IsDuringPlay() && _terrain->IsActiveInHierarchy()) |
| 2237 | PhysicsBackend::RemoveSceneActor(scene, _physicsActor); |
| 2238 | PhysicsBackend::DestroyActor(_physicsActor); |
| 2239 | PhysicsBackend::DestroyShape(_physicsShape); |
| 2240 | PhysicsBackend::DestroyObject(_physicsHeightField); |
| 2241 | |
| 2242 | _physicsActor = nullptr; |
| 2243 | _physicsShape = nullptr; |
| 2244 | _physicsHeightField = nullptr; |
| 2245 | #if TERRAIN_USE_PHYSICS_DEBUG |
| 2246 | _debugLinesDirty = true; |
| 2247 | SAFE_DELETE_GPU_RESOURCE(_debugLines); |
| 2248 | #endif |
| 2249 | #if USE_EDITOR |
| 2250 | _collisionTriangles.Resize(0); |
| 2251 | SAFE_DELETE_GPU_RESOURCE(_collisionTrianglesBuffer); |
| 2252 | _collisionTrianglesBufferDirty = true; |
| 2253 | #endif |
| 2254 | _collisionVertices.Resize(0); |
| 2255 | } |
| 2256 | |
| 2257 | #if TERRAIN_USE_PHYSICS_DEBUG |
| 2258 |
no test coverage detected