Godot-proposals: Import collision shape without adding redundant static node

Created on 1 Mar 2020  路  7Comments  路  Source: godotengine/godot-proposals

Describe the project you are working on:
I'm working on a 3D space sim/4X game.

Describe the problem or limitation you are having in your project:
My base objects are already static bodies, and all I'd need is to import the collision shape, without adding any other node in between. While the current flags are useful (-colonly, -col, etc.), they all add a static body by default.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
I think that godot could be improved in one of two ways, the sophisticated one and the simple one:

  • Detect that the collision shape is being added to a node of a type that uses collision shapes, and abstain from adding a static body node in that case, removing redundancy and clutter. (area, static body, etc.)
  • Just add another flag to signal when you want the shape to be imported without static mesh (for example -colshape)

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
The first option would require to check the parent type before adding static bodies and do so only when the parent is not aware of collision shapes. It's a tougher beast, because it would change the result, and so, could break people's projects if they expect the current redundant layout.

The second option would require just another flag, as the ones already present, with an even simpler implementation. It would not break any previous works, becasue it would only impact those that use the new flag.

If this enhancement will not be used often, can it be worked around with a few lines of script?:
It looks like it can. (But I don't know how, because adding a script would execute during game runtime each time an instance is created, and it's a step that can be more efficiently made at import time just once)

Is there a reason why this should be core and not an add-on in the asset library?:
I'd say that because the importer is part of the core, its improvements also belong there.

import physics

Most helpful comment

I'd go for -colshape and -colshapeonly for this.

All 7 comments

I'd go for -colshape and -colshapeonly for this.

Please fill in the issue template, it is mandatory. I will reopen as soon as it is done.

Nevermind, I'll just edit the first post with the headers.

Next time, please keep the titles in the template.

Next time, please keep the titles in the template.

I thought I followed the instructions by answering all the title "questions". I swear I don't recall reading the bit about keeping the titles there. Sorry, my bad.

Nevermind, I'll just edit the first post with the headers.

Thank you! I've updated it to answer ALL of them.

I have the same issue in my project.

It would be very useful for rigid bodies. Currently if I want to have a model with several meshes as a rigid body I need to import it without any collision and assign it manually. In this case -rigid is not useful because it will generate a separate rigid body for each mesh. -colshape could solve this issue.

I will try implement, give me a few days :)

Was this page helpful?
0 / 5 - 0 ratings