I have a ‘container’ object (it’s child five cubes arranged like an open box with a rigidbody on their parent). Inside the ‘container’ is a bunch of objects with rigidbodies. When the player character pushes around the box, the interior objects should only fall out of the open end of the box. However, some objects are passing through the sides. They’ll often pass through the floor too.
I demonstrate my issue in this video:
wbfbso
In this video, I explain the hierarchy of my container object:
e9j615
This looks like good ol’ tunneling. How thick are you container walls? (In units) they seem pretty thin to me, and thin objects are more prone to this kind of issue.
I see you’re using discrete collision detection for your rigidbodies, which means collisions do not take object velocities into account. This might cause objects to easily pass trough thin colliders. Have you tried using continuous collision detection instead?
They are pretty thin walls, I hadn’t considered making them thicker. Maybe I’ll try that. Thank you.
As for what kind of collision detection, I’ve tried all the settings!
In my current iteration, I now have all the objects inside the bin set to isKinematic = true, and I use a translate command to ‘push’ them out of the bin and then I switch off isKinematic upon exit. Not exactly an elegant (or totally realistic looking) solution, but at least things aren’t popping out this sides which is worse looking.
What it does is it basically looks for pair of objects whose velocity-expanded bounding boxes overlap, and consider them as potential collisions. Compared to regular collision detection (which doesn’t expand bounding boxes to account for velocities), this makes collisions between moving objects a lot more robust.
Making objects thicker always works because that increases the chance of them overlapping even if you don’t consider their velocities during collision detection. This should be a last resort though.
In games, it generally doesn’t really matter if something happens or not as long as it looks like its happening. The player cannot see stuff wobbling around inside the container, so as long as it looks like it was full of stuff once it falls down, it’s fine. Your solution is probably a bit more performant too!