The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote

Hi All,

I have a working solution to this issue, but I am mostly concerned about the scalability of my solution. I am using a Navigation2D object for pathfinding in my game, and one of the obstacles my NPCs might have to navigate around are doors that are locked or unlocked. The NPCs are easily capable of navigating unlocked doors, but I had some trouble getting them to recognize locked doors. My solution was to break up my navigation polygons into one for each individual room, and then give each lockable door its own navigation polygon. Then, I add the navigation polygon as a child of the Navigation2D if the door is unlocked and I remove the navigation polygon as a child of the Navigation 2D if the door is locked. Is this a viable solution if I anticipate having a maximum of maybe 30ish rooms in a level? If not, is there a better way to implement doors inside of a Navigation2D?

in Engine by (33 points)

For what it's worth I came to the same solution as you. However rather than adding and removing the doors' navigation polygon from the tree, I just enable and disable it using the 'enabled' property. This works fine in my situation. If you/anyone has a better solution I'd also like to hear it :)
[Godot v3.5.1]

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 Frequently asked questions and 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 [email protected] with your username.