Skip to content
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

Add a SeparationCylinderShape3D and radius to SeparationRayShape3D/2D #9730

Open
ettiSurreal opened this issue May 12, 2024 · 1 comment
Open

Comments

@ettiSurreal
Copy link

ettiSurreal commented May 12, 2024

Semi-related: #2751

Describe the project you are working on

Experimenting with a 3D Platformer.

Describe the problem or limitation you are having in your project

This is not exactly a problem I'm currently facing, but still wanted to bring this up.
SeparationRayShape2D is a great feature, it lets you for example:

  • Make it so jumping into a ceiling pushes you in either direction if you only barely touch it.
  • Similar concept, but for horizontally bumping into a ceiling pushing you downward.
  • Simple handling of going up stairs.

SeparationRayShape3D uses the same concept, but in 3D it kind of falls apart due to omnidirectionality. To do the things I've mentioned above, you'd need to have many individual collision shapes (potentially hundreds), which I imagine would negatively impact performance, and give you a "cogwheel effect" where you can get inbetween collision shapes on corners or small collisions.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

To me, an obvious solution is to:
A) add a new shape that would function exactly like SeparationRay, but in a circle with optional height (so you don't have to duplicate it). Would solve the "jumping into ceilings" example.
B) Add cylindrical radius to SeparationRayShape3D (and potentially 2D, for consistency), It would be an easy solution for stepping.
This will not work for shapes that aren't capsules, spheres or cylinders though, so if this is big enough concern, a rectangular or polygonal mode would be required.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

A new SeparationCylinderShape3D collision shape.
It would have have radius and height settings like CylinderShape3D, but function similarly to a SeparationRayShape3D, where it would push itself away (or colliding objects away from it) if they entered the collision from either top or bottom cap.
Basically just imagine a shape that's an infinite amount of SeparationRayShape3Ds spun in a circle, duplicated an infinite amount of times across a straight line.
image

A radius parameter in SeparationRayShape3D (and potentially 2D), it would add a cylindrical volume to the ray, so it would basically work as an opposite to the shape proposed above.
image
It could also potentially support rectangular or polygon shapes, if the issue stated before is high enough concern.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Is it even possible to make custom Shape2D/3D derived collision shapes? I haven't seen anyone do that.

Is there a reason why this should be core and not an add-on in the asset library?

A more useful version of an existing feature.

@AThousandShips
Copy link
Member

I'd say this should be two different proposals, as one is about adding a new feature and the other about changing an existing one, arguably in a way that affects the exiting use cases of it, that would need to be discussed more, so it'd be more useful to separate the two

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants