A game which would use modular assets to build levels and props.
Describe the problem or limitation you are having in your project
Currently, within the scene importer, you can enable physics generation on an imported MeshInstance node, and select a physics type. Rigidbody, StaticBody, or Area.
This will generate a separate physics object for each mesh you enable this option for.
This means there is no way to generate collision for several meshes under a single body.
This is also limited to generating CollisionShapes, meaning you can't import custom CollisionShapes that were created prior within a 3D modeling application as children of the visual MeshInstance.
If you want to generate only collisionshapes for a mesh, currently you would have to:
Create a new scene
Instance the imported scene and select edit children or make local
Select the mesh
Select Create Collision Shape
Since this scene is separate from the imported one, if I make any changes to the mesh externally and reimport, the collision would no longer match the mesh, and I would have to open the scene with the collision shapes, and regenerate and replace them manually.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add a way to generate CollisionShapes and parent them directly to the mesh on import.
Also add a way to import a mesh as collision shape(s) instead, with the ability to select the shape, or determine the shape type on import from object names: For example, Unreal Engine allows you to prefix a mesh name with UCX_ (convex) UBX_ (box) UCP_ (capsule) USP_ (sphere) and _## for the index. like UCX_SomeMesh_01 will import as a convex shape for SomeMesh while UBX_SomeMesh_02 will import as a box scaled to the collision mesh vertices.
This way collision shapes will update on reimport and you can avoid having to generate them separately.
Another small improvement would be for imported collision shapes to be named after the mesh that they are for, instead of leaving all shapes named CollisionShape3D
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Locally, I have the PR for indirect collisionshape children working, and I also tried making some changes to the importer:
Also, instead of changing the imported scene root type to a physics type, you could just add the imported scene underneath the physics type you want.
So you could reuse the same imported scene for rigidbodies, staticbodies, and areas.
You could also add several imported models as indirect children of a physics node instead of them needing to be separate bodies.
Here's how you could create a StaticBody for a room and it's props using this:
If this enhancement will not be used often, can it be worked around with a few lines of script?
I'm not sure.
Is there a reason why this should be core and not an add-on in the asset library?
Importing scenes is core functionality in the editor.
This would improve the modularity of imported assets when using them as part of larger physics objects.
Describe the project you are working on
A game which would use modular assets to build levels and props.
Describe the problem or limitation you are having in your project
Currently, within the scene importer, you can enable physics generation on an imported MeshInstance node, and select a physics type. Rigidbody, StaticBody, or Area.
This will generate a separate physics object for each mesh you enable this option for. This means there is no way to generate collision for several meshes under a single body.
This is also limited to generating CollisionShapes, meaning you can't import custom CollisionShapes that were created prior within a 3D modeling application as children of the visual MeshInstance.
If you want to generate only collisionshapes for a mesh, currently you would have to:
edit children
ormake local
Create Collision Shape
Since this scene is separate from the imported one, if I make any changes to the mesh externally and reimport, the collision would no longer match the mesh, and I would have to open the scene with the collision shapes, and regenerate and replace them manually.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Important: This feature would require https://github.com/godotengine/godot/pull/77937 be merged in order to work.
UCX_
(convex)UBX_
(box)UCP_
(capsule)USP_
(sphere) and_##
for the index. likeUCX_SomeMesh_01
will import as a convex shape forSomeMesh
whileUBX_SomeMesh_02
will import as a box scaled to the collision mesh vertices.This way collision shapes will update on reimport and you can avoid having to generate them separately. Another small improvement would be for imported collision shapes to be named after the mesh that they are for, instead of leaving all shapes named
CollisionShape3D
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Locally, I have the PR for indirect collisionshape children working, and I also tried making some changes to the importer:
Also, instead of changing the imported scene root type to a physics type, you could just add the imported scene underneath the physics type you want. So you could reuse the same imported scene for rigidbodies, staticbodies, and areas.
You could also add several imported models as indirect children of a physics node instead of them needing to be separate bodies. Here's how you could create a StaticBody for a room and it's props using this:
If this enhancement will not be used often, can it be worked around with a few lines of script?
I'm not sure.
Is there a reason why this should be core and not an add-on in the asset library?
Importing scenes is core functionality in the editor. This would improve the modularity of imported assets when using them as part of larger physics objects.