This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes


i currently work on EnemyAI and try to let follow an enemy the Player.
So on, this will work, but i don't get a collision detection.

As you can see here, there are many collisions and i want the enemy walk arround this.
But i don't get it.
enter image description here

Only the Green Grass is sayed it is an Navigation. My Tree Construct is this:
enter image description here

My Code for this Event is this (the Enemy does not follow the Path, maybe you see the fail)

    if Navi != null:
    var path = Navi.get_simple_path(player.global_position, global_position)
    Line.points = path
    if path.size() > 1:
        var start_point = position
        var distance = MovementSpeed * delta
        for i  in range(path.size()):
            var distance_to_next = start_point.distance_to(path[0])
            if distance <= distance_to_next and distance >= 0 :
                position = start_point.linear_interpolate(path[0], (distance * 5)/distance_to_next) 
            elif distance < 0:
                position = path[0]
            distance -= distance_to_next
            start_point = path[0]

i hope you can help and understand me!


Godot version 3.2
in Engine by (14 points)

1 Answer

+1 vote

Hey! Her`s something I found in the Internet: (are you looking for something like this? HerĀ“s the totorial:

by (82 points)

ah ok, so i have to do this manually?
Thank you.

Maybe you can me help with this:
I have decided to change my movement to an gridbased movement. I don't get it to change my navigation to this movement and don't found any tutorial for that.

Do you have a idea how to change this?
My Current Movement without Navigation

var Real_Walk_direction = Walk_direction * Constant.TILE_SIZE
if Real_Walk_direction != Vector2.ZERO:
    CollisionDetiectionSnap.cast_to = Real_Walk_direction
    if !CollisionDetiectionSnap.is_colliding():
        SmoothAnimation.interpolate_property(self, "position", position, position + Real_Walk_direction, 1.0 / Speed,  Tween.TRANS_SINE, Tween.EASE_IN_OUT)

Its my solution. (Id never say it`s the only one. But I have no idea how to change your code. Sorry

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.