Heavy performance killing bug with physics
It appears this bug can reduce the framerate to 0fps! I'm using a physics handle for grabbing objects and throwing them. These objects consists of actors which have just simple box collisions that are welded together. So like ca 10 box actors welded together. Every time a object is grabbed again the framerate gets reduced while that object is physic simulated. First I have 90 fps, after the 30th grab I have like 10 fps. However, when the physics simulation is set off it jumps up to 90, when set on again back to 10fps.
To recreate: At runtime spawn several box actors and put them perfect close together (It is a random constellation for me) attach weld all to the first actor. On input 1: Set that first actor to be physics simulated and grab it with a physics handle. (don't forget the set target location every tick, I also set the rotation to 0 every tick since the physics handle rotation constraint does not work) On Input 2: release the actor, make a delay and set physics simulation off. At play use input 1 and input 2 several times and see the framerate dropping everytime. (I'm using no gravity on the box actors and make use of set impulse and add force after a object is released from grab. I'm also changing the collision type from vehicle to physics object and back again)
I have no idea what exactly is causing the framerate drop, maybe it even has nothing to do with physics handles nor welding collisions and it is a general physics bug.
Here is also that physics handle bugs report where I briefly mentioned this: https://answers.unrealengine.com/questions/423767/physics-handle-rotation-now-completely-broken.html Since I'm not sure if that is connected to physics handles and this is a heavy problem I made this a own post.
We touched on this briefly in the other post. Thought I'd post this here too just to make sure we had full coverage. It sounds like this related to an issue we've recently fixed (but that won't be released until 4.13).
The fix is pretty simple though. If you're using the source version, go to Engine\Source\Runtime\Engine\Private\PhysicsEngine\BodyInstance.cpp, at around line 2037 (in FBodyInstance::Weld).
Modify the function like so:
The important bit is that second if statement (the rest should already be present).
Let me know if that resolves your frame rate issue.
Thanks, Jon N.
answered May 27 '16 at 01:32 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here