Chaos contact modification

Hello everyone!
How to modify collision contacts in ue5? I’ve found static member CollisionModifierCallback inside FPhysScene_Chaos, but looks like it doesn’t implemented yet (i got unresolved external symbol compilation error when trying to set any function and also i can’t find any usages inside unreal)

Found ISimCallbackObject::OnContactModification_Internal, will try

Yes, this works, you can create class inherited from TSimCallbackObject and register your callback:
PhysScene->GetSolver()->CreateAndRegisterSimCallbackObject_External(true);
after that each contact will be reported to FMyContactModifyCallback::OnContactModification_Internal where you can modify it.
However it’s a little tricky to get FBodyInstance or UPrimitiveComponent from here and i didn’t found proper solution (but you can try FPBDRigidsSolver::PhysSceneHack and FPhysScene_Chaos::GetBodyInstanceFromProxy)

1 Like

Hello! Can you please expand on it a bit?
I am stuck on creating an inherited class.
Does OnContactModification_Internal need to be overridden?

I managed to complete it. Your comment helped a lot! Thank you!
I managed to get FBodyInstance from Proxy. Working like a charm!

1 Like