Allow pathfinding through a wall
Asked Answered
A

3

0


I have a broken fence that I want the enemies to be able to pathfind through but not the player, is there any way I could do this?

Anticlimax answered 8/1, 2023 at 23:5 Comment(0)
D
0

Could different values of the navigation_layers property be used for player and enemies?
https://docs.godotengine.org/en/stable/classes/class_navigation.html#class-navigation-property-navigation-layers

Decelerate answered 8/1, 2023 at 23:36 Comment(0)
L
0

Place an area and script a special event that gets triggered when pressing some interaction key binding that then plays a special animation/mini-curscene for climbing through the fence hole when pressed. On area entered display a non-modal prompt for 'press [keybinding] to climb through' or such then on is_action_pressed('interact') move the character controller into a predetermined position within the bounds of the area so the animation can play perfectly showing the character climbing through and on animation finished you position the character controller on the other side as you want. Could use a key in the animation method track for that last bit determining when the animation ends and to trigger the method placing the character on the other side.

In the above example I'm only considering the player controller but there's no reason this couldn't be made to work for npc's as well, just the player camera wouldn't focus on them climbing through. In effect 2 areas would likely be needed for each side since you likely want it to be passable both ways.

Laurettalaurette answered 9/1, 2023 at 4:49 Comment(0)
U
0

Since by the debug visuals of the navigation mesh you are on Godot 4 use a NavigationLink3D to cover the gap(s) between the navigation meshes for AI where you want movement through the broken fence parts.

Underpass answered 2/3, 2023 at 0:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.