codecat / godot-tbloader

TrenchBroom Loader for Godot 4. (Alternative to Qodot)
MIT License
243 stars 32 forks source link

Various brush entity improvements and fixes #24

Closed EIREXE closed 2 years ago

EIREXE commented 2 years ago

This includes:

codecat commented 2 years ago

Thanks for the PR! I'll take a closer look at the code hopefully tomorrow.

a brush entity doesn't have to make use of collision at all

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?

EIREXE commented 2 years ago

Thanks for the PR! I'll take a closer look at the code hopefully tomorrow.

a brush entity doesn't have to make use of collision at all

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.

codecat commented 2 years ago

Most of the code looks good! 🎉

One thing I don't understand though is why are you passing ColliderType::None to build_entity_mesh and then calling add_collider_from_mesh later? That should already happen correctly in build_entity_mesh, shouldn't it?

I also have some minor style nitpicks if you wouldn't mind changing them 😊 image

codecat commented 2 years ago

Invisible walls IMO should be done with a special clip texture like quake/source does that is configured in the TBLoader node

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)

EIREXE commented 2 years ago

One thing I don't understand though is why are you passing ColliderType::None to build_entity_mesh and then calling add_collider_from_mesh later? That should already happen correctly in build_entity_mesh, shouldn't it?

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.

I also have some minor style nitpicks if you wouldn't mind changing them blush

Should be OK now

codecat commented 2 years ago

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.

This is why, when passing ColliderType::Mesh to build_entity_mesh, it adds the collider using add_collider_from_mesh to the specified parent. I think it would do the same if you pass a mesh collider type using need_collider = ColliderType::Mesh;, similarly to how it is done for RigidDynamicBody3D.

EIREXE commented 2 years ago

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.

This is why, when passing ColliderType::Mesh to build_entity_mesh, it adds the collider using add_collider_from_mesh to the specified parent. I think it would do the same if you pass a mesh collider type using need_collider = ColliderType::Mesh;, similarly to how it is done for RigidDynamicBody3D.

Hmm yeah you are right, I've gone ahead and done that

codecat commented 2 years ago

Thank you! 🎉