![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | sxkod |
Morning All
I am trying to come up with a plan of dividing the scene in to small chunks and then build a level using the small assets. However, each asset could be a building for eg and the city could be made with roads and a random collection of buildings player can enter. Road will have it’s own navmesh.
However, I am wondering if there is a way to use CSGCombiner to generate the master navmesh up on ready.
For eg: pick all the child meshes belonging to say “nmx” group from each asset, add them as children to a CSGCombiner, set operation to “union” and then extract the result. This resulting mesh can then be sent to NavigationMesh.new to create the actual navmesh for the whole level.
Am I getting it completely wrong? I managed to start off but stuck at extracting the result of the CSG operation
Any help greatly appreciated.
If there is a better way to have each asset carry it’s own navmesh and then join them on _ready, please guide me
Thanks
func _ready():
var px=get_tree().get_nodes_in_group("nmx")
var comb=CSGCombiner.new()
var mx=CSGPolygon.new()
for n in px:
n.get_parent().remove_child(n)
comb.add_child(n)
comb.operation=CSGShape.OPERATION_UNION
var nmx=NavigationMesh.new()
## NOW WHAT!!!
There’s an addon to export a CSGCombiner to the OBJ format (which could be imported as a mesh):
CSG Export (.OBJ Mesh) - Godot Asset Library
I can’t exactly say if that applies to your problem. But perhaps it helps.
wombatstampede | 2020-04-07 15:00
Hi Wombatstampede
I will try to see if I can learn from the link you added - thanks.
However I am trying to see if I can merge all the child nav meshes procedurally from all assets and create a big nav mesh for the whole level.
Any other ideas/ ways to add navmesh to procedurally generated levels ?
Thanks
sxkod | 2020-04-07 16:05