So I have a game where the player is inside a cube. The player has isGravity on. I spawn the enemies (who are NOT affected by gravity) on the opposite side of the cube. I want them to travel the inner edges of the cube to get to the player as quickly as possible. I have gotten to travel around the cube, but not in a very effective way for them or my program.
Any help?
Imagine enemies walking along the interior of a rubics cube.
Try make some AI that can find you on flat ground if you haven’t done so already since pathing or moving in general across different planes as well as finding a route to the player is no simple task.
An idea could be that since there are only 6 internal faces to be on, the AI will go towards the player if they are on the same face, simple enough. If they are on different faces it will take the quickest route to that face, or if on opposites, the closest other face. Eventually the AI would make it to the same face and then it will track the player. Similar to how ive done Zombies in the past to follow players upstairs when not on the same ‘area’. Path to somewhere that joins the areas and then their regular pathing can take it from there.
AI is hard but its really fun when you get things going and you can see your creations do stupid things
If the enemy is on one of the adjacent faces, the shortest path is always over the edge connecting the faces and as you see the line isn’t that hard to calculate (red enemies).
Now, if the enemy is on the opposite face (orange enemy), it’s probably easiest to just try out all 4 (light green) possibilities and take the shortest one.
