Add Tapered collision shapes #116707
Conversation
|
Here is a video demo: Screencast.From.2026-02-24.14-24-54.mp4The UVs on the top of the tapered cylinder aren't quite correct yet |
|
godotengine/godot-proposals#610 is implemented by this PR Just to clarify : I haven't yet checked the physics in game, there may be a mismatch between what's seen and what's collided with |
|
sorry about the wrong styles, I hadn't setup everything to have it run automatically, this is my first contrib... |
|
For completeness: this also addresses the original proposal, godotengine/godot-proposals#12875 |
23ddd21 to
08c6748
Compare
|
Physics have been made and tested to work with both Godot physics server (using regular non-tapered variants) and Jolt tapered_physics.mp4 |
|
I'll note here that a lot of the code between the tapered Cylinder and tapered Capsule is very similar, maybe it could be merged into a single parent class? Also, I haven't made icons for the meshes or the shapes. I tried to have a go at it, but in the end it was programmer art... Finally, maybe there could be a button to convert non-tapered cylinder/capsules into their tapered variants and vice-versa? |
|
@Moddingear Please run |
aaronfranke
left a comment
There was a problem hiding this comment.
Looks pretty good from my perspective. Needs these property info changes, and a rebase+squash, and approval from physics folks.
02e46a7 to
0ab802f
Compare
|
I did the squash+rebase, but I kept the original commit from #109009 to keep their contribution |
0ab802f to
d28e417
Compare
|
Last change is so that the tapered capsule, both mesh and collision, correctly handle being turned into spheres. There was a superfluous test to avoid that, but Jolt actually handles the case just fine... |
|
I'm having a rebase issue, will undraft when fixed |
| //This condition isn't necessary, as Jolt handles the case where the capsule becomes a sphere | ||
| //ERR_FAIL_COND_V_MSG(mid_height < Math::abs(radius_top - radius_bottom), nullptr, vformat("Failed to build Jolt Physics tapered capsule shape with %s. Its mid_height must be at least the absolute value of the difference of its radii. This shape belongs to %s.", to_string(), _owners_to_string())); |
There was a problem hiding this comment.
We tend to remove code that isn't used. Not merge blocking.
There was a problem hiding this comment.
Yeah, I left it since someone might think that this case needs to be handled. I can remove that but doing a squash would invalidate the approval from @jrouwe
There was a problem hiding this comment.
I noticed that commented out code too, but I think it's instructive as it is a tempting condition to add
|
When testing this I have found that for these tapered shapes, including the mesh instances, you can't make one side have a radius of 0. It is set to 0.001, not true 0. The only shape that can be truly 0 is the built in cylinder mesh instance which can already be tapered. Idk if this is intentional or a bug. |
|
That is to align with https://github.com/eoineoineoin/glTF_Physics/tree/master/extensions/2.0/Khronos/KHR_implicit_shapes#gltf-schema-updates standards |
|
@TheCogster409 In the case of the shapes, Jolt explicitely requires the shapes to have radii greater than 0 (Maybe this could be relaxed ?). But I do believe that it can be handled better, so i'm going to compare with CMP_EPSILON for the shapes, and allow the mesh to reach 0 value, and when it does, optimize the geometry on the end with 0 radius, like the cylinder does currently |
|
In this instance, I think conic is just the case where one radius is zero |
Co-authored-by: Aaron Franke <arnfranke@yahoo.com>
Tapered capsule shape indeed doesn't accept 0 as top or bottom (prevents having to check for div by zero), but the tapered cylinder shape does. |
|
@jrouwe I've allowed 0-radius cylinders in the latest version @AThousandShips I've rename radius_top and radius_bottom to top_radius and bottom_radius everywhere in the new files that are user facing, but not in the Physics server as it's new and can be aligned to Khronos standards. The code to generate the vertical lines on the capsule collider was thoroughly documented so it's more understandable. Also, now the tapered capsule generated mesh handles 0-radius ends. |
|
Just needs the code readability fixed, none of the implicit conversions |
AThousandShips
left a comment
There was a problem hiding this comment.
Style and documentation look good! Haven't tested the functionality

This is the continuation of #109009
I've fixed the mesh generation of the tapered capsule, and right now am looking at also adding tapered cylinders.