Describe the project you are working on
I am working on GLTF support in Godot.
Describe the problem or limitation you are having in your project
The Khronos group had a meeting about physics the day I am writing this proposal, and decided that GLTF physics materials should be per-shape. The opinion of the Khronos group is that per-shape physics materials are important, should be in the base GLTF physics extension spec, and the spec should require implementations to support them.
Godot currently only has per-body physics materials, so if a GLTF file has a body with multiple shapes and each has per-shape physics materials, it's not possible to import that file and have it behave the same. Technically you could import the data as multiple bodies, but that would likely break other things.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
The enhancement is to add physics materials to the CollisionShape3D node. This would allow us to have per-shape physics materials, which allows us to import the Khronos group's proposed GLTF physics materials.
Note that aside from GLTF compatibility, per-shape physics materials may also be useful for Godot users in general. Many other engines have per-shape physics materials, including Jolt, so adding this to Godot's physics nodes would help with using the full capabilities of third-party physics engines in Godot. During the Khronos group meeting they mentioned that most engines they've worked with had this feature and Godot is the odd one out here.
An example use-case of per-shape physics materials would be a hammer. The handle of the hammer is made out of a different physics material from the head of the hammer. It is not possible to simulate a hammer's materials correctly in Godot's current physics system, unless you used 2 bodies with a weld joint holding them together, but that would be likely to cause other issues.
We may wish to do the same in 2D as well for feature parity - but for the moment, I am primarily interested in 3D.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Add a new property to CollisionShape3D: physics_material. These would work similarly to the properties on RigidBody3D. The per-body physics material can be kept to keep simple use cases simple. If the shape's physics material is set, it will take priority over the body's physics material.
Note: RigidBody3D's physics material is currently called physics_material_override, but as far as I can tell this is a mistake. It doesn't actually override anything, this is the only physics material property I can see. I think this should be renamed to physics_material in Godot 5.0 (and move the property to PhysicsBody3D instead of RigidBody3D, actually considering the name difference this part could be done during Godot 4.x) or possibly just removed.
If this enhancement will not be used often, can it be worked around with a few lines of script?
It can't be worked around in script - at least, not without multiple bodies, which would likely break other things.
Is there a reason why this should be core and not an add-on in the asset library?
This is a core part of the physics system.
Describe the project you are working on
I am working on GLTF support in Godot.
Describe the problem or limitation you are having in your project
The Khronos group had a meeting about physics the day I am writing this proposal, and decided that GLTF physics materials should be per-shape. The opinion of the Khronos group is that per-shape physics materials are important, should be in the base GLTF physics extension spec, and the spec should require implementations to support them.
Godot currently only has per-body physics materials, so if a GLTF file has a body with multiple shapes and each has per-shape physics materials, it's not possible to import that file and have it behave the same. Technically you could import the data as multiple bodies, but that would likely break other things.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
The enhancement is to add physics materials to the CollisionShape3D node. This would allow us to have per-shape physics materials, which allows us to import the Khronos group's proposed GLTF physics materials.
Note that aside from GLTF compatibility, per-shape physics materials may also be useful for Godot users in general. Many other engines have per-shape physics materials, including Jolt, so adding this to Godot's physics nodes would help with using the full capabilities of third-party physics engines in Godot. During the Khronos group meeting they mentioned that most engines they've worked with had this feature and Godot is the odd one out here.
An example use-case of per-shape physics materials would be a hammer. The handle of the hammer is made out of a different physics material from the head of the hammer. It is not possible to simulate a hammer's materials correctly in Godot's current physics system, unless you used 2 bodies with a weld joint holding them together, but that would be likely to cause other issues.
We may wish to do the same in 2D as well for feature parity - but for the moment, I am primarily interested in 3D.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Add a new property to CollisionShape3D:
physics_material. These would work similarly to the properties on RigidBody3D. The per-body physics material can be kept to keep simple use cases simple. If the shape's physics material is set, it will take priority over the body's physics material.Note: RigidBody3D's physics material is currently called
physics_material_override, but as far as I can tell this is a mistake. It doesn't actually override anything, this is the only physics material property I can see. I think this should be renamed tophysics_materialin Godot 5.0 (and move the property to PhysicsBody3D instead of RigidBody3D, actually considering the name difference this part could be done during Godot 4.x) or possibly just removed.If this enhancement will not be used often, can it be worked around with a few lines of script?
It can't be worked around in script - at least, not without multiple bodies, which would likely break other things.
Is there a reason why this should be core and not an add-on in the asset library?
This is a core part of the physics system.