I'm having a "Matryoshka" problem

Godot Version

v4.1.3.stable.official [f06b6836a]

Question

I’m trying to build a specific test in the physics environment that fails. I’m trying to create a convex shape from a mesh for a rigid body. It must obey gravity. It must be a convex, trimesh or a collision shape. It can be a hollow can or it can be a simple torus. But, it doesn’t collide with the cylinder that’s supposed to catch it in the middle. It will fall through and strike the floor. It’s a simple exercise I’m basically trying a wooden ring stacking game. Or, trying to capture a ball in a bell. But, the physics don’t recognise a convex collision on the inside of the mesh. Maybe I can flip the mesh vertices? If that’s a thing in Godot.

I actually was working on a simulation that needed rigidbodies with concave collision shapes. So the mesh had to be decomposed into convex shapes.

I updated a blender addon for decomposing the mesh, and I made a custom import script for creating a scene with the rigidbody and collisions.

Let me know if you need any help. I just made this so it is all fresh in my mind.

1 Like

Oh, and my guess on your problem is that Godot uses V-HACD on very speedy settings to make a collision mesh when importing.

This results in the collision mesh being a sort of shrink wrapped convex shape around the entire mesh. So no holes or concavities.

In my blender script you can adjust the settings and use the superior (for concave shapes) CoACD algo.

And also, a single concave shape cannot model a ring for a fing toss game or a bell or cup with an interior area.

That requires concave shapes.

But the physics engine requires convex shapes for rigidbody3d.

So what can you do? Decompose the convex (ring or cup) shape into multiple convex shapes.

That is what my scripts are for.

Yes. The symptoms you’re describing. My guess was trying to use a basic boolean shaped mesh. Maybe cut the torus in half and try it that way. But, that’s only available with the CSG Combiner. That only works for CSG Primitives. My guess CSG>Mesh>Collision is out of the question. I may try it with some Maya/Max meshes later. Thank you some much for replying to the question. It appears I can now predict this problem before attempting anything similiar.

in my professional opinion it is required to use a full flat torus for OpenGL. I think it uses ranges instead of plains.

Well, the using the CoACD algorithm to automatically break it up in blender is pretty painless with the scripts I linked (you do also need to download the CoACD bimary from its repo).

If you wanted to avoid all that you could make some quick and dirty colliders within Godot.

Make a rigidBody3d

Use your mesh for visuals only (meshInstance3d as child of rigidbody)

Add multiple basic convex collision shapes (boxes?) to approximate the shape

I am pretty sure you can do that all within the Godot editor

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.