Description

Here's a workaround

void DestroyParticle(TGeometryParticleHandle<T, d>* Particle)
	{
		auto PBDRigid = Particle->CastToRigidParticle();
		if(PBDRigid)
		{
			RemoveFromMapAndArray(PBDRigid, ActiveParticlesToIndex, ActiveParticlesArray);
			RemoveFromMapAndArray(PBDRigid, TransientDirtyToIndex, TransientDirtyArray);

			if (auto PBDRigidClustered = Particle->CastToClustered())
			{
				if (Particle->GetParticleType() == Chaos::EParticleType::GeometryCollection)
				{
					bGeometryCollectionDirty = true;
				}
				else // clustered
				{
					RemoveFromMapAndArray(PBDRigidClustered,
						NonDisabledClusteredToIndex, NonDisabledClusteredArray);

//					if (Particle->ObjectState() == EObjectStateType::Dynamic) // ## workaround : removing this condition
					{
						RemoveFromMapAndArray(PBDRigidClustered,
							ActiveClusteredToIndex, ActiveClusteredArray);
					}
				}
Steps to Reproduce
  1. Open attached project on ue4.26-chaos engine (CL#16225500) [Link Removed]
  2. Play in editor
  3. A few seconds later, one of the GeometryCollections is destroyed and a crash occurs.
Callstack

> [Inline Frame] UE4Editor-Chaos.dll!TArray<Chaos::ClusterId,TSizedDefaultAllocator<32>>::RangeCheck(int Index) Line 674 C++ Symbols loaded.
[Inline Frame] UE4Editor-Chaos.dll!TArray<Chaos::ClusterId,TSizedDefaultAllocator<32>>::operator[](int) Line 718 C++ Symbols loaded.
[Inline Frame] UE4Editor-Chaos.dll!Chaos::TPBDRigidClusteredParticles<float,3>::ClusterIds(int Idx) Line 121 C++ Symbols loaded.
[Inline Frame] UE4Editor-Chaos.dll!Chaos::TPBDRigidClusteredParticleHandleImp<float,3,1>::ClusterIds() Line 960 C++ Symbols loaded.
UE4Editor-Chaos.dll!Chaos::TPBDRigidClustering<Chaos::TPBDRigidsEvolutionGBF<Chaos::FRewindableEvolutionTraits>,Chaos::FPBDCollisionConstraints,float,3>::AdvanceClustering(const float Dt, Chaos::FPBDCollisionConstraints & CollisionRule) Line 1266 C++ Symbols loaded.
UE4Editor-Chaos.dll!Chaos::TPBDRigidsEvolutionGBF<Chaos::FRewindableEvolutionTraits>::AdvanceOneTimeStepImpl(const float Dt, const float StepFraction) Line 357 C++ Symbols loaded.
UE4Editor-Chaos.dll!Chaos::TPBDRigidsEvolutionGBF<Chaos::FRewindableEvolutionTraits>::AdvanceOneTimeStep(const float Dt, const float StepFraction) Line 157 C++ Symbols loaded.
UE4Editor-Chaos.dll!Chaos::AdvanceOneTimeStepTask<Chaos::FRewindableEvolutionTraits>::DoWork() Line 288 C++ Symbols loaded.
UE4Editor-Chaos.dll!Chaos::TPBDRigidsSolver<Chaos::FRewindableEvolutionTraits>::AdvanceSolverBy(const float DeltaTime) Line 884 C++ Symbols loaded.
UE4Editor-Chaos.dll!Chaos::FPhysicsSolverAdvanceTask::AdvanceSolver() Line 102 C++ Symbols loaded.
UE4Editor-Chaos.dll!TGraphTask<Chaos::FPhysicsSolverAdvanceTask>::ExecuteTask(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & NewTasks, ENamedThreads::Type CurrentThread) Line 886 C++ Symbols loaded.
[Inline Frame] UE4Editor-Core.dll!FBaseGraphTask::Execute(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & CurrentThread, ENamedThreads::Type) Line 524 C++ Symbols loaded.
UE4Editor-Core.dll!FTaskThreadAnyThread::ProcessTasks() Line 1065 C++ Symbols loaded.
UE4Editor-Core.dll!FTaskThreadAnyThread::ProcessTasksUntilQuit(int QueueIndex) Line 888 C++ Symbols loaded.
[Inline Frame] UE4Editor-Core.dll!FTaskThreadBase::Run() Line 540 C++ Symbols loaded.
UE4Editor-Core.dll!FTaskThreadAnyThread::Run() Line 965 C++ Symbols loaded.
UE4Editor-Core.dll!FRunnableThreadWin::Run() Line 86 C++ Symbols loaded.
UE4Editor-Core.dll!FRunnableThreadWin::GuardedRun() Line 27 C++ Symbols loaded.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-115328 in the post.

1
Login to Vote

Cannot Reproduce
ComponentUE - Simulation - Physics
Affects Versions4.26-chaos
Target Fix4.27-chaos
CreatedMay 10, 2021
ResolvedApr 27, 2022
UpdatedMay 10, 2022
View Jira Issue