0 votes

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!!!
in Engine by (79 points)

There's an addon to export a CSGCombiner to the OBJ format (which could be imported as a mesh):

https://godotengine.org/asset-library/asset/563

I can't exactly say if that applies to your problem. But perhaps it helps.

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

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.