-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve collision generation usability in the new 3D scene import workflow #3155
Comments
In some point generating more than 1 simple collisions per mesh would be also useful |
Do you have an example? Withe VHACD we should cover more or less all the cases. |
Unfortunately, I don't have examples. I'm not expert with VHACD. I imagine this like in Unreal when open mesh editor. There I can create simple collisions and change position, size. Edit: V-HACD should support custom collision, which can be created in modelling program like Blender. Just need specials letters at the start of object name |
Yup, that's how I imagine it too.
We already support custom collision imported via blender, and this one will not change. |
Great idea! It would be useful to have such options. I have some comments and suggestions:
Why is it useless now? Is there a different way to disable importing the visual mesh?
It would be great to have different modes, because VHACD is a lossy algorithm and in some cases you just want to generate a basic convex hull. It could be another drop-down list in the convex settings to set the generation mode: Simplify and Decompose would have more settings for VHACD (as you mentioned), and maybe they could be just one option, with a max number of convex hulls to set (so 1 would just simplify). |
Originally this feature was added to insert meshes that was supposed to be converted to collisions. So in your GLTF you had two meshes, the main one and the collision only one (with postfix Considering this, the best would be to just hide that option from that DD, but still leave the flag
Ok, I'll add that.
The idea is to expose all the settings that VHACD has, it's definitely useful to know that each mode has a different set of settings, I'll add those! :) |
Ok, makes sense to remove the option in the UI then. |
@pouleyKetchoupp now that I've checked how VHACD works, I've few questions on the modes you proposed.
As you mention, I'll collapse Simplify and Decompose into one. I guess, it made sense differentiate those two modes since it was the only tweaking we could do. Now we can, so have just one option seems the most clean way. Regarding Basic, it seems like generating a convex shape using all the vertices of the mesh, but however VHACD does the same thing but in a better way, so I wonder what's the benefit of having it at all? If the benefit is just marginal, I think we can just avoid such option, so to keep the UI clean and easy to use. |
Since VHACD can modify the geometry, Basic is useful because it's the only way to ensure the original vertices are preserved. The only changes it does is removing duplicates. It can be used for example in cases where users just want to keep the exact geometry from a mesh that's already convex. |
ok make sense, I'll add that too. |
The new workflow is awesome! I have a suggestion. For now there is a limitation with collision generation for each mesh. Let's imagine I want to create a physics-enabled object. I have two options:
Both workflows above are inconvenient. This approach should be better in general, so I proposing to use "Root" for "Body type" by default. In this case your root scene will represent the actual type and it will be convenient to interact with it (for example, apply force or take coordinates) and you will also have less objects: What do you think about it? |
Opened a proposal about my message above: #3355 |
It is possible right now to use post import script to generate collision for your meshes, but generating collisions on import is such a useful feature it should be included as standard in the editor. However, I think it is a good idea to allow users to manually specify meshes to use for collision, as it's possible to make much cleaner convex meshes than vhacd, as well as boxes, capsules and spheres and assign multiple colliders to a single object. I made a post import script for Godot 3.4 to import collision meshes from a gltf file based on object naming conventions. This workflow is currently broken in Godot 4.0 because the option to import objects in a single file as separate scenes is missing, but I found it very helpful for importing asset pack objects for static level geometry, as I could just drag the scenes from the file tree into the 3d viewport and have collision, and there was no additional manual setup of collision meshes outside of Blender. Here is an image showing an asset and File Tree view for a game jam game I made. The file RoadParts.glb contained all the various road related assets I was using, and when imported, a scene for each object was generated, each with collision meshes set up exactly how it was in Blender. I really hope we can set up a simple pipeline/workflow for this kind of ease of importing (and reimporting!) The scene hierarchy is shown here, but using the post import script you can arrange it differently (i.e. flat hierarchy, or put the static body as root). You can see the script here in case you are interested. Another thing that may be worth mentioning is that generated LODs could potentially be used for collision meshes in cases where a convex decomposition is unsatisfactory, although I'm not so sure how fast or robust non-convex collision is in Godot. Unreal allows this, and it works pretty well for static geometry. I'm mentioning this because Godot got new LOD generation features recently. |
See also godotengine/godot#39924 and the discussion within for ideas on how to improve this workflow. |
As of Godot 4.1, you will be able to specify the collision information inside of the GLTF file. This means that you can set up physics before importing and no configuration in the import dialog will be necessary. Currently the only way to generate GLTF files with physics information is by exporting from Godot 4.1+, but in the future you will be able to export physics information from Blender. |
Describe the project you are working on
A first person game, that has many maps with a lot of colliding meshes (Dynamic and Static).
Describe the problem or limitation you are having in your project
Right now it's difficult to generate the collisions for an imported mesh, so that the model can be drag and drop immediately inside the map.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
The idea is to enhance the Advanced Editor Import Window, so it's more effective generate collisions for a Mesh.

We already have support for generating the colliders, it uses the VHACD lib but we don't have control over it. Also, the editor doesn't show the generated collider either, so it's difficult to handle it.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
This is a short video that should give an idea on what to expect: https://user-images.githubusercontent.com/8342599/129878371-add60334-513d-43ed-bf07-441d65a0a599.mp4
The new UI will allow to select the collider types using the property
generate/physics
, and you can select:Once the
Collider
is selected a new set of properties appear:The property Shape allow to select between:
Per each of these Shapes, we will have a set of properties that we can use to tweak the generated shape. For example, selecting Generated Convex, the editor will show the VHACD settings, or selecting the Box, we will be able to change the shape position and box sizing.
Notice that the editor will show immediately the generated shape, directly on the Advanced Import Window, so that we can see immediately the final generated shape, and we can more effectively tweak the available settings of the chosen shape.
If this enhancement will not be used often, can it be worked around with a few lines of script?
This is an Editor enhancement.
Is there a reason why this should be core and not an add-on in the asset library?
This is an Editor enhancement.
The text was updated successfully, but these errors were encountered: