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 AABB (Simple Box) to Collision Shape Type in Mesh > Create Collision Shape #9685

Open
Nodragem opened this issue May 5, 2024 · 3 comments

Comments

@Nodragem
Copy link

Nodragem commented May 5, 2024

Describe the project you are working on

Top Down Shooter with Modular Asset Kits

Describe the problem or limitation you are having in your project

I can easily create complex collision shapes, but I cannot easily create the simplest collision shape of all: the AABB (Axis-Aligned Bounding Box).

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

One argument for not adding it before (can't remember the issue number) was that it would clutter the Mesh menu. But since Godot 4.3dev6, we have a new pop-up menu that allows to add a lot of different ways of making Collision Shape for MeshInstance3D (godotengine/godot#86627) 🎊 🍾 🎊 .

image

We can now simply add an entry "Axis-Aligned Bounding Box (AABB)" to that menu! 🚀

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

In GDScript it looks like that: https://github.com/Nodragem/twin-stick-shooter-starter-kit/blob/make-new-level/tools/automation/build_collision_boxes.gd

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

yes it can! I did. But just feel a bit silly that I need to code it when Create Collision Shape already exist for more complex shapes!

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

Create Collision Shape already exists in core. We simply add the most basic one.

@Calinou
Copy link
Member

Calinou commented May 5, 2024

I would also expose sphere, capsuld and cylinder options, although there will need to be a way to choose the capsule/cylinder axis.

@aXu-AP
Copy link

aXu-AP commented May 7, 2024

I think making an extra option appear if the user chooses capsule or cylinder.
kuva

Additionally for sphere, capsule and cylinder it is needed to determine radius/height since they don't have 3 axes of dimensions. Use average, smallest or largest dimension? Maybe have a grow/shrink parameter to adjust the generated shape?

In similiar vein, but not directly related, advanced import also has option to generate collision primitives to meshes, but user needs to manually input all the values. For consistency and better import workflow it would be nice to generate those from aabb also.

@Nodragem
Copy link
Author

Nodragem commented May 9, 2024

The alignment option looks great. I can't really think about the use cases for sphere/cylinder/capsule on top of my head, but it seems to be a nice-to-have if that's not adding too much work.

Also, while we are there, we should probably not repeat (and solve) this bug when creating the AABB:
#91755

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

4 participants