In godot for hollow objects ,when we are put another material into that. collision is not working properly, help me by suggesting the solution.
Example Scenario:
i am putting a coin into a testube ,collision is not working properly,after running this scene the coin exit from the testube and go outside.my expected output is coin should retain in that test tube.

Well, maybe break it down kind of like walls and a floor. It wouldn't be perfectly the shape of a test tube, but maybe close enough to deceive the viewer. The collision shapes are invisible.

How did you model the tube?
If it's modeled as a simple solid convex shape, e.g. a capsule, cylinder, or single convex hull, then it's not valid to put anything inside it. There would be no hollow space.
If it's modeled as a trimesh (concave mesh), make sure that you've modeled it correctly (with only the space between the internal and external walls of the sides of the tube being inside the shape), and that the middle is not actually solid. You can test that by putting the coin above the top of the tube and testing that it falls down into it, rather than resting on the top as if it was a closed shape.
Also note that the trimesh shape is supported only for static bodies.

If you're not using a trimesh, you have to model all sides of the tube, and the bottom as separate shapes. Creating such a concave shape in any of the supported physics engines is a bit complex or inefficient.
You could create a narrow cuboid or convex hull the height of the tube (excluding the rounded bottom of it, if there is one), and make copies of it rotated all the way around. (Don't use the Node3D.Transform to do the rotation at runtime though.) And create the bottom of the tube as other shapes.
It won't be perfectly curved, and you'll have to choose the number of sides as a compromise between accuracy and performance.
All of the shapes that make up the shape must not intersect, as far as I know.
You might also have problems if the sides were very thin and something hit them going very fast.

    @fire7side and @johnlambe are right on target!

    back the day (in my old engine): i had come up with a solution for this where a tube would be created by copying multiple mesh instances and give each a collision shape. the copies would be arranged in a tube-like shape such as an octagon or 16-a-gon.

    This would create the effect of a hollow tube and as long as you can get all of the collision shapes close enough then the effect would work.

    You should be able to do that using 3D Nodes in Godot. If I get time later this week, i'll give it a go and see if i can recreate it as an example project.

    p.s. After i posted that project, another user built the same concept but put the shapes inversed to create a awesome physics effect that he ran a car through. I dont have the projects anymore but i'm certain Godot can do it and maybe even better.

    Edit: would be nice (albeit very physics processing expensive) if we could get a mesh-based collision shape.
    (now watch that already exist, rtfm for me, lol)

      Update:

      I found this and am exploring it: https://docs.godotengine.org/en/4.1/tutorials/physics/collision_shapes_3d.html

      For instance, a pyramid is convex, but a hollow box is concave.

      Godot lets you use convex decomposition to generate convex shapes that roughly match a hollow object.

      Concave collision shapes, also called trimesh collision shapes, can take any form, from a few triangles to thousands of triangles. Concave shapes are the slowest option but are also the most accurate in Godot. You can only use concave shapes within StaticBodies. They will not work with KinematicBodies or RigidBodies unless the RigidBody's mode is Static.
      -
      Note:
      Even though concave shapes offer the most accurate collision, contact reporting can be less precise than primitive shapes.

      Hope that helps for now

      johnlambe

      Thank you very much for this reply.
      i designed a glass tube with a separate solid bottom, when dropping coin into the tube collision of the bottom part is fine.
      After that i closed the glass tube with a lid. while flipping the glass tube randomly the coin goes out through the side walls of the tube. i,e its not retain in that tube.
      i hope u will help me for solving the issue

      If you're modeling the tube in Blender, you can create a cylinder with no end caps, then add a Solidify modifier which will add an inside surface and rims, like a thick-walled pipe.

      Then name it with a "-col" suffix, export it (i.e. as GLB or GLTF), and the Godot importer will automatically create a concave collision shape for it.

      You can also use Curves to create long flexible tubes by fiddling with the geometry/bevel and resolution parameters, again, with no end caps and a Solidify modifier. It's amazing what you can do with that.

        synthnostate Your proposal sounds great and give me an idea for a fun game.

        Could you do up a tutorial for how to set this up in Blender please? i think it would really help both me and the sarark πŸ™‚

          9 days later