(SOLVED) How to put a Static Mesh (with physics) inside a container, i.e. a drawer?

Hi everyone. I have a question. I want to put items (cans, guns, etc), with Physics enabled, inside containers, like chests, crates, drawers etc, but the items spawn outside or on top of the containers, even if their meshs fit inside the containers. The containers have the proper collision (they are hollow). I am using Complex Collision as Simple just to be sure. The physics volume is larger than my container and it is causing the static mesh I have put inside the container to pop out during Begin Play. If the container is big enough to fit the physics volume, the items fall or stay nicely inside the container. The problem is that even with small objects, like say a pen, the physics volume is way to big. Is there a way to reduce the physics volume or any other workaround that doesn’t involve disabling the physics or creating huge containers?

All my meshes are created with real life measurements in mind so scaling up the containers is out of the question.

This is how the collisions look for the whole setup.

It reacts weird only if the item is inside the drawer and the drawer is inside the furniture. I checked all the collisions gave them simple box collision by hand… still the items spawn outside the furniture.

Please let’s find a solution.

Thanks in advance.

SOLUTION: Turns out there was nothing wrong with any of the meshes, their collision or the physics volume and that the project itself was acting weird. Migrating everything into a new project fixed the issue.

You should be able to generate fitting collision volumes inside unreal. Open the mesh, remove collision and regenerate it. That should fix it.

It is not a collision thing, since this happens to even the smallest mesh (i.e a pen) put inside a drawer. As I have already said in my op.

If the container is big enough to fit the physics volume, the items fall or stay nicely inside the container.

Can you try spawning them on top of the open drawer and seeing if they fall in? Sometimes even a tiny overlap can cause the physics collision to break.

Have you checked your drawer mesh? It has to be that either your drawer volume is too big so you must regenerate it OR the item volume is too big so you have to regenerate it. If not you are doing some custom calculations that we cant help with.

You could also post some screenshots or make a youtube vid showing the problem and your code and meshes.

Rod in drawer. The mesh and its collision are obviously smaller than the drawer mesh. When you press play the rod spawns either on top of the whole furniture or in front of it. Notice how the physics volume (green cross) collides with the drawer.

Same drawer scaled up times 3. The mesh lands inside the drawer. Notice how the physics volume (green cross) does not collide with the drawer.

In both cases I used the same blueprint for the items inside the drawer. All these without any code running and all meshes use Complex Collision as Simple, I hope this will make it clear once and for all that the issue is with the physics volume, not the meshes and not their collision. No matter what mesh you use be it inside a blueprint or alone, be it a pencil or a mountain, the physics volume, that green sphere, has the same size.

The question is, can the physics volume shrink with blueprints or C++ or is there another work around? Because scaling all the containers x3 is not an option as you can imagine.

http://puu.sh/qr3oN/7984cf9b28.jpg

As you can see, the collision is flat and hollow inside the drawer mesh. It does not consist of one flat cube collision volume as in this picture.

http://puu.sh/qr3yl/59f7f8e97a.jpg

So, as I said, you have to fix your collision volumes.

When you use “Complex as Simple” the collision primitive becomes the mesh itself so the collision in the case of the drawer is hollow either we like it or not. If its collision primitive was a flat cube the stone as shown in the second image would have reacted the same as the rod during begin play, i.e. it would have spawned anywhere but inside the drawer.

Just to be more clear, here is a pic of the drawer with its collision. As you can see it is not a flat cube.

Go to the top in the mesh window, and remove all collisions then add 5 collisions of cubes(Box) and align manually in each face and the bottom of the mesh that easy. (Moving and scaling with the top controls)

Note all this options are in the button Collisions in the top middle of the mesh window.

Done that too, did’t work. Also tried using collision meshes.

Hold on I will make a simple box and try everything all of you have said. brb.

Ok update. If you move the drawer and leave it outside the furniture, the items stay in.

It reacts weird only if the item is inside the drawer and the drawer is inside the furniture. I checked all the collisions as you said, gave them simple box collision by hand… still the items spawn outside the furniture.

Does the furniture have collision? Is that furniture collision crashing?

Before you do, I want you to do me a favour. Put the drawer half into the furniture, put an object inside and in the EDITOR click on SHOW and check COLLISION. Then look at the drawer and item like I did in my example images.

It has simple boxes as you suggested earlier. Do you believe it is a mesh issue? Maybe importing it into a 3D Modelling software and exporting it again may do the trick or I could just check the mesh all together. What do you think? Since the drawer works alone, it must be the furniture.

Ok will post the image.

So this is the image with everything as it was, and how the problem started. Let me know if you see anything odd with the collision because although I like puzzles, this one eludes me.

To be honest I can not see if it collides, but try this. Set physics to work on the object inside only. Make sure it is as close to the furniture as possible with some room to slide inside the drawer. Then make the drawer slowly move into the drawer and see if the object stops as it hits the surface of the furniture. IF it does, then you have collision in the furniture that is causing a problem. Redoing the collision might be needed. If not I am out of ideas.

It seems fine does’t it? Furniture and Drawer use Complex as Simple and the Rod has it’s on simple cylindrical collision primitive, so there must be a stray collision somewhere in there. I will do as you suggested, then I will import the mesh into Blender and see if I can find anything. If not I am out of ideas also.

The last thing I can try is create a whole new, level or project, start troubleshooting it on other levels.

Calling it a day. Thank you all for your time and patience. I will be back tomorrow with any progress I make. Have a nice evening/day everyone.