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.
-
AuthorPosts
-
November 9, 2022 at 6:19 pm #34001
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!November 10, 2022 at 9:09 am #34006This 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 foreverSet the AI mind to use the new behavior tree
That should be a reasonable base to get started and get the behavior you want.
November 16, 2022 at 12:07 pm #34172Ok 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.
November 16, 2022 at 12:39 pm #34177Make 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.
November 18, 2022 at 1:33 pm #34336Thank 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.
-
AuthorPosts
You must be logged in to reply to this topic.