x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

(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.

alt text

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.

Product Version: UE 4.12
Tags:
more ▼

asked Aug 05 '16 at 01:23 PM in Blueprint Scripting

avatar image

Sutorcen
166 7 13 18

avatar image Majkl Aug 05 '16 at 06:08 PM

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.

avatar image Sutorcen Aug 05 '16 at 06:20 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

4 answers: sort voted first

Update: So I imported the furniture mesh into Blender and did some fiddling around (checked for doubles, did a remesh etc) I exported it again (as .FBX) and imported it back into Unreal, did the collisions manually and it did the same as before, didn't hold the items inside the furniture. Anyway, so next I imported everything into a new project and lo and behold it worked as it should in the first place. I got rid of the old project and I am continuing work in this one. Never thought this could happen.

Thank you guys for everything, turns out your suggestions were sound but the problem was elsewhere.

more ▼

answered Aug 06 '16 at 10:12 AM

avatar image

Sutorcen
166 7 13 18

avatar image NoobsDeSroobs Aug 06 '16 at 12:33 PM

That does sound weird. At least you got it to work.

avatar image Sutorcen Aug 06 '16 at 12:38 PM

Yes it was weird. Thank you for your help.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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

more ▼

answered Aug 05 '16 at 03:35 PM

avatar image

NoobsDeSroobs
2.7k 106 34 177

avatar image Sutorcen Aug 05 '16 at 05:35 PM

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.

avatar image NoobsDeSroobs Aug 05 '16 at 06:25 PM

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.

avatar image Sutorcen Aug 05 '16 at 07:44 PM

alt text

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.

alt text

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.

avatar image NoobsDeSroobs Aug 05 '16 at 08:07 PM

alt text 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. alt text

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

avatar image Sutorcen Aug 05 '16 at 08:15 PM

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. alt text

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Aug 05 '16 at 08:29 PM

avatar image

Hevedy
633 62 77 113

avatar image Sutorcen Aug 05 '16 at 08:29 PM

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.

avatar image Sutorcen Aug 05 '16 at 08:47 PM

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.

avatar image NoobsDeSroobs Aug 05 '16 at 08:49 PM

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

avatar image Sutorcen Aug 05 '16 at 08:52 PM

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.

avatar image NoobsDeSroobs Aug 05 '16 at 08:55 PM

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.

avatar image Sutorcen Aug 05 '16 at 08:56 PM

Ok will post the image.

avatar image Sutorcen Aug 05 '16 at 09:01 PM

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.

alt text

avatar image NoobsDeSroobs Aug 05 '16 at 09:09 PM

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.

avatar image Sutorcen Aug 05 '16 at 09:13 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Aug 05 '16 at 09:16 PM

avatar image

Sutorcen
166 7 13 18

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question