Various brush entity improvements and fixes#24
Conversation
|
Thanks for the PR! I'll take a closer look at the code hopefully tomorrow.
Right, but the opposite is also correct; not all brushes need visual but do need collision, for example invisible walls. Would that still be possible with this change? |
Invisible walls IMO should be done with a special clip texture like quake/source does that is configured in the TBLoader node, I have such thing implemented already in my own branch but it's not in this PR, my plan was to add it together with nodraw textures for skipping faces as a separate PR. |
I agree, but I think it should work both ways too. Perhaps this is not a problem though, particularly because I also want to allow customizing whether visual/collision is enabled through entity properties. (But that's for a separate issue/commit) |
97e5ffa to
7dfcf3a
Compare
Because the idea is that in the case of brush entities collision shapes should always be children of the entity instead of children of the mesh as is the case in static mode.
Should be OK now |
This is why, when passing |
7dfcf3a to
9a99aae
Compare
Hmm yeah you are right, I've gone ahead and done that |
| add_collider_from_mesh(node, mesh, need_collider_shape); | ||
| } | ||
| } | ||
| MeshInstance3D* mesh_instance = build_entity_mesh(idx, ent, node, ColliderType::Mesh, need_collider_shape); |
There was a problem hiding this comment.
I think you want to use need_collider here?
This includes: - Generate one mesh instance per entity, instead of one mesh instance per texture, this seems like a much more sensible way than using one meshinstance per texture - Fix the rotation of brush entities, previously the transform was applied on top, however this is wrong as the brush entity's geometry is already in godot space (and brush entities have no rotation anyways). - Always generate visuals for brush entities, this is because a brush entity doesn't have to make use of collision at all - Generate brush entity collisions as siblings of the mesh instance if the brush entity is of a physics type, this is so the parent is the one that handles all the physics of the brush entity
9a99aae to
3b6d7ca
Compare
| // Create instance name based on entity idx | ||
| String instance_name = String("entity_{0}_geometry").format(Array::make(idx)); |
There was a problem hiding this comment.
Doing this loses the entity name given in Trenchbroom. Do we really need that?
There was a problem hiding this comment.
Actually, this might only lose the texture name, so it probably doesn't matter that much.
There was a problem hiding this comment.
Yeah the point of that is that since we are now grouping textures into one mesh its a better idea to just use the entity id
|
Thank you! 🎉 |

This includes: