retrace/Characters/Meldewesen/Meldewesen.gd
karl d2ee524f72 Fix issues with Meldewesen pathfinding
The NavigationMeshInstance now keeps larger distances from obstacles to
avoid the Meldewesen from colliding with them while traversing the
correct path.

A possible issue with the look_at vector has been fixed as well.
2019-11-11 10:16:03 +01:00

32 lines
803 B
GDScript

extends KinematicBody
export(NodePath) var _visibility_path: NodePath
var _visibility: Area
func _ready():
Logger.set_logger_level(Logger.LOG_LEVEL_FINE)
_visibility = get_node(_visibility_path) as Area
if _visibility:
_visibility.connect("body_entered", self, "_on_body_entered_visibility")
_visibility.connect("body_exited", self, "_on_body_exited_visibility")
func _on_body_entered_visibility(body: Node):
if body.is_in_group("Player"):
print("Seeing player!")
Logger.info("Seeing player!")
# TODO: Check if the Player is in an area where they shouldn't be
# TODO: Follow the Player
func _on_body_exited_visibility(body: Node):
if body.is_in_group("Player"):
print("Stopped seeing player!")
Logger.info("Stopped seeing player!")
# TODO: Stop following the Player