Physics object settle after X?

Is there a way to tell your physics objects to “settle” or stop simulating after a specific amount of time? I notice that a physics object with a sphere collision will never actually stop moving for example so its always fires an Event Hit. Or sometimes an object will continue rendering physics on a rough surface which makes it looks “wobbly” when it should be laying still. I’m just wondering if there’s some way to tell all physics objects to stop simulating physics after say 5 seconds once they’ve collided with a surface. Just until they’re collided with again and then it would re-enable physics simulation.

Not sure what you really want? To stop the physic or stop motion or stop gravity?

I want physics objects to stop attempting to simulate after a few seconds to avoid situations where they attempt to simulate for too long. I don’t want to disable it entirely, I just want an object to know when to quit so to speak. If its collided with another object for example, and its been 5 seconds since that collision, it should stop simulating until the player picks it up or something else bumps into it again. In Source engine this was called wake and sleep and you could tell a physics object what wakes it and what sleeps it.

I really don’t understand why you can’t just turn off physics until player picks it up then turn it on? I’d probably need to see this wake and sleep in action to really understand. Well I do hope you get this working by now. Good luck.

Ahh, okay. Thank you for clarifying. I think you should play around with the node Set Linear Damping if you haven’t already. You should be able to pull it out from the balls static mesh or change it from the ball detail panel. It pretty much just slows down the physics.

I hope this helps you out.

Ok so imagine that you have a basketball mesh with a sphere collision. You enable physics on pickup and then drop the ball on the ground… even if the ground is flat, the ball will keep rolling around and generating hit events even though in real life the ball would eventually lie still after a moment. I’m trying to stop this sort of thing from happening. My workaround is that I created a custom collision that’s not perfectly smooth but I was thinking there might be a way to tell a physics object to settle on its own after X time. If I disable physics simulation on the object, then its more difficult to turn it back on again under every possible circumstance that might cause the ball to move again.

Yeah I have adjusted the linear damping quite a bit… maybe its just not a high enough amount. The problem is that I’m using a master blueprint for all of the interactable physics objects in my game so they all share the same linear damping so a setting that might work for one object won’t work for another. I probably have to create an enum for several different types of linear damping (like small, medium, large etc.) and then use that to set the amount on a per object basis. Thanks for the help.

Just use a “get all class” then set a variable integer to index all of them. That way you can single them out.

Here’s a perfect example of this issue that I’m trying to stop actually:

The mesh uses a simple box collision so you’d think it would just lie flat and not wobble but it does.

That is strange. Collision would be the first thing I’d check too. How about weight? You tried changing it? Sometimes objects randomly get very light. Also you can try to rotate the mesh upside down and see if it’s still persistent. As for my last suggestion would be to re-import the mesh. I stack books before and it never wobble. Not sure why your is acting up. Sorry for not being very helpful but this is all I can think of. Good luck.

Yeah I’ve done all of the above. I’ve seen this happen in games a lot actually. In fact, its been happening in Fallout 4 lately too with skeleton ragdolls that they use to decorate the environment. I’ve always wondered why they don’t just tell physics objects to stop simulating after 7 seconds. There has to be a way to do this in UE4 but I have no idea how.

Pasting this here in case if anyone needs to look for something like this. It’s kind of crude but the point is that the actor draws a trace directly down and when it hits something, it triggers a delay that checks again if it is still hitting that object. If it’s true, then it’ll turn off physics simulation.

The “Draw Trace Down” and “Draw Trace Up” nodes here are just functions I compiled. You can use any kind of trace to get the hit result you need.

I haven’t looked into this in-engine yet, but I just had a thought, from a hit event you could actually just get the velocity of the actor and check if it’s below a certain threshold and if it is, disable physics simulation as well. Might be easier than doing a line trace. Granted, I’d also do a sphere trace instead of a line trace as it gets all directions.

1 Like