I have code in my project to switch characters between ragdoll mode and normal mode. When I switch between them, I call GetMesh()->SetSimulatePhysics(...)
with true
and false
respectively.
The issue is that this call has zero effect, unless I manually recreate the physics state afterwards by calling GetMesh()->RecreatePhysicsState()
If I run in PIE, enter ragdoll mode (without calling recreatephysicsstate), and then inspect the mesh in the details panel, the bSimulatePhysics is true. If I then toggle that property in the details panel, so that its off, it starts simulaing physics… And it still simulatesif i again toggle it back on. Which is really odd behaviour.
If I dont add theRecreatePhysicsState
workaround while exiting ragdoll mode, while bSimulatePhysics IS becoming false, a following call to attach the mesh in question to another component silently fails (likely because its still considered being simulated).
If I add the RecreatePhysicsState
workaround, any impulses that are added in the same frame have no effect (with no warnings in log).
I didnt have this issue with 5.1 preview 2, but it happened sometime soon after I upgraded to the 5.1 release.