News Forums Troubleshooting Simple move towards player issue

This topic contains 4 replies, has 3 voices, and was last updated by  rbranch1 1 month, 1 week ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #34001

    Gamedude
    Participant

    Hi,
    I am currently creating a game where the enemies swarm the main character but I am having some issues.
    I set up my enemies so that they have a behavior tree that only says detect player with the visual sensor and then move to player detected variable. When I set it to move to waypoints it will use the navmesh and properly move towards those but it won’t move towards the player. Is there a different way I can set this up so the enemy is constantly moving towards the player after it is spawned? Any help would be appreciated, thanks!

    #34006

    prime
    Keymaster

    This should be pretty straightforward.

    - Add an Entity to the player.
    - Add a Visual Aspect with aspect name player

    - Create an AI.
    - Add a Visual Sensor. Make sure the range is large enough to detect the player

    - Create a behavior tree
    Parallel
    — Detect node - use “Visual Sensor” and set the aspect to “player” and the aspect variable to player. repeat forever
    — Move node - set Move Target to player. set close enough distance to 2. repeat forever

    Set the AI mind to use the new behavior tree

    That should be a reasonable base to get started and get the behavior you want.

    #34172

    rbranch1
    Participant

    Ok I have been working with those instructions for days and havent gotten anything to move. It’s ridiculous, I named the aspect the same as the aspect variable, and did everything listed up there. I can see the entity labeled as a dot on the player. I can also see the sensor dome when i click on the AI. I go to the scene and im within the sensor dome with the player. The player does nothing but stay inn its original preset animation.

    #34177

    prime
    Keymaster

    Make sure in your detect node you are using the quotes around “Visual Sensor” and “player”. (e.g., Visual Sensor is wrong, “Visual Sensor” is right)

    This is because those fields are Expressions. In an expression, items without quotes are variables. Items with quotes are strings/labels/names.

    Is that the issue? If not, feel free to post screen shots (like a shot of your BT Editor with the detect node selected) or send us the project to take a look at.

    #34336

    rbranch1
    Participant

    Thank you so much for your help :). At the least, my ai is following the player. I have somewhere to be, but i can now go more in depth with my project (animations, navigation etc.) later.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.