[UE5.1] Trouble with physics and collisions

I’m having trouble with a part of tree that a NPC actor (robot on a wheel) is chopping down. Most of the parts of the tree fall down correctly. But one log tends to fall through the ground. If it doesn’t fall through, then anything that touches it will likely cause it to fall through. If you leave the log alone, it will eventually tip on its side until it falls through. Also, the NPC actor will roll on top of the fallen branches of the tree sometimes even though I’ve set them all to not be able to step onto them. I just want the branches and logs to just move out of the way. But I can’t seem to do it. What’s really weird is that there are two logs. The other log is fine. They both have CCD on. Doesn’t help.

The logs have different meshes (different parts of the tree) and different collision meshes. But everything else is the same. I once saw that the pivot point was under the ground when it was tipping over. Could this be a problem? Perhaps a bug in UE5? I thought it only used the collision mesh. Does the pivot point need to be inside the mesh? I’d rather not change it as it makes aligning all the parts more difficult.

And is there a simple way to just push objects out of the way instead of going over them or sometimes flinging them across the map? I even set the correct mass on each item. Is there an easier way than switching to overlap triggers and adding impulse? This seems way overcomplicated.

edit: Here’s a short video of what I’m talking about.

I’ve discovered a few things.

First is that constraints will be broken if two objects collide with enough force or with an object that isn’t being simulated with physics. This is very annoying as it likely means I’ll have to keep checking to ensure the constraints are still there.

Second, it seems that physics doesn’t like the option “Use Complex Collision As Simple”. If you have this set on an actor that you enable physics, you’ll get an error. But what it doesn’t tell you is that it doesn’t like this option on anything that the physics enabled actor collides with either. You must have a simple collision mesh for everything that interacts with the actor that is being simulated with physics. I don’t know if this will solve the falling through the ground problem completely, but it seems to help a lot.

For the branches being flung across the map, I still need help. For now, I’ve disabled all collisions between the robot and the branches. I added an overlap event handler so that it adds X amount of force per second for as long as they overlap. This just pushes them off a bit and is close to the effect I was looking for. It still feel very hacky though.

I also learned that the checkbox to generate ovelap events must be on both actor components. I don’t know why this would be a requirement, but there it is.

If anyone has simpler solutions to any of this, please let me know.

edit: Nope. Log still falls through the ground. Still better than before, but not good enough.

Mainly commenting here so that this gets a bump… I’d like to know how this gets worked out, and I hate it when something like this basically gets buried in an avalanche of less researched questions.

What’s your ground looking like? Are there any material settings in there that could be the culprit?

The ground is a runtime mesh component. So maybe that’s the problem. The collision mesh is created at runtime from the main mesh. It’s possible there’s a bug in my code, but everything else works fine on it. One of the logs still tilts on its own and I can’t figure out why. It might be happenning when I change the collision settings on it. I do this so I can pick it up.

As for the material, not sure how that can affect collisions. Not using any physics material.

I have a few things to try. 1. Disable physics when changing collision settings. 2. Create a blocking volume.

Thanks for helping :slight_smile:

I tried disabling physics when changing collision settings on the logs and I think that fixed it. I ran it 10 times in a row and everything worked fine. I even enabled collisions on the robot and it still worked fine. Physics must be running and updating the actor position in a background thread. At one point, the code sets all collisions to be ignored and then sets the two channels I want to collide with. From all indications, during that one line of code when collisions are disabled, it was enough to tilt or make the log fall through the ground. My guess is that it tilted when falling and then when collisions were re-enabled, physics just pushed it back up above the ground, but ended up looking weird (standing up on its side).

I want to try it for a bit longer. If everything still works, I’ll mark this as resolved.

As a side-effect, I’m now seeing that the robots are throwing the logs forward when dropping them besides the hut. I think this is from my disabling physics when changing collision settings (IOW, the constraints are no longer applying so the logs keeps going forward after the robot stops). lol. But I think I can easily fix that part.

Yes, I was referring to physics materials… sounds like you have it pretty well under control though. Way over my head in terms of reading and understanding code!