50% framerate drop when a physics actor wakes

So I have an inventory system which features physics actors for items that are on the ground. When picked up, they are set not to simulate. When dropped, they are turned back on and set awake.

To rule some stuff out - it happens even if CCD is off on the item physics actor, and both the item physics actor and the level geometry are simple collision boxes or capsules.

What happens is - if all the items are sleeping, the performance is normal (100-120 FPS depending on what’s on screen). If an item is dropped, the performance instantly goes down to about 50FPS. Waking multiple physics actors doesn’t seem to decrease this further linearly, so even if you drop 5 items, it stays with that 47-50FPS range.

Literally the moment the actor (or all awake actors) goes back to sleep, the framerate jumps back to normal 100-120FPS.

I haven’t tried breaking the test out into a separate project yet or anything, but it should be easy to reproduce by making a static mesh with collision, turning it into a physics actor, and waking it and observing a perf hit.

This has happened to be when I was adding columns for my room and all the sudden my framerates are dropping like crazy. GPU and CPU are fine (AMD Radeon HD 7990 and 3.60Ghz) to gaming lingo yes I’m bottlenecking and I don’t care. Not important. What I’m saying I should ever get a framerate dropping and none of the other programs except for Google Chrome are running for me to watch a tutorial video.

Okay so one more thing ruled out - I had these physics items doing replicates movement.

I just tried it without and it has the exact same problem, no FPS gained by turning off replicate movement.

Howdy n00854180t,

Would you be able to post this issue on our AnswerHub, if you have not already? This would help us to investigate exactly what you are currently experiencing. Here is link to the AnswerHub: https://answers.unrealengine.com/index.html.

If you could also follow this template on how to report a bug and provide the information that it currently asking for, this would be most beneficial for us in our investigation. Here is said template: How do I report a bug? - Programming & Scripting - Unreal Engine Forums

Thanks and have a great day!

Sure thing, I will make a separate project and hook it up as simply as possible to repro the case, and upload it tonight along with the AnswerHub post.

Also thanks for unbanning me guys - I posted the last reply in this thread during an apparent ban wave and got caught up in it.

Okay so I’m not having much luck getting a repro case - I set up a similar test case in an empty project and I had to spawn about 500 box actors to even get a framerate dip. Not sure what’s going on in my project that’s so different that it would cause that 50% frame hit as soon as a physics actor wakes.

Edit: Tried testing on a new map in my own project - no slowdown in the pickup/drop case. I even had it spawning dozens of the items that were causing problems without issue. It’s got to be something in the level.

Edit again: Even weirder - the slowdown only happens if the actor is awake and resting on a surface… not when it’s flying through the air (when thrown) or such. Really odd. I’m going to go through and systematically remove things from my test level until I pinpoint what’s causing the slowdown before I go and put it up on AnswerHub.

I’m getting something oddly similar. Extreme framerate drop when going through a box collision - and more frequently occurring when character is in the air. https://answers.unrealengine.com/questions/250525/endless-runner-lag-when-passing-box-trigger-w-end.html

do you by any chance switch the physics on while the actors, i.e. their collision geometries, are overlapping or while they overlap with something else? Than can give extreme fps drops. It results in the situation, where the usual ‘ragdoll explosion’ is only one step away.

I know this is an old thread, but I was having this issue in 4.25.3
Just in case this this might help someone with a similar problem. I had a bunch of static meshes in a level which I set to simulate physics. All of a sudden when ever the meshes physics would wake or if it was connected to a physics handle the frame rate would drop to 30fps in the editor and a packaged game. When I looked at the settings for the static mesh’s collision, I saw that “Can Ever Affect Navigation” was checked. This wasn’t a problem in the past, but I recently was messing with navigation settings and needed to set the “Runtime Generation” to Dynamic in “Project Settings > Navigation Mesh > Runtime”. So the issue was that as the physic mesh was moving around it was simultaneously updating the nav mesh causing the frame rate to drop. When I set “Can Ever Affect Navigation” to false on all the meshes that were set to simulate physics, the frame drop did not occur.

3 Likes

Thank you!
I had this exact problem (exactly same situation, I also at some point changed the navmesh to dynamic and had no idea it was related to that) and this was the exact solution I needed.