This object uses the pathfinding behaviour to follow my character, but whenever I move near objects for pathfinding, the objects move to different positions randomly.
Why are you picking all Player objects? Is there more than 1?
[edit]
I’d look into looping through all the enemies and running the find path action on each one, rather than all at once. That way you can also check the path was found.
Was this what you meant? If so, I don’t think it worked.
I picked all Player objects because if I didn’t, the Monster’s would pathfind to (0,0).
I’m pretty sure the pathfinding works well, its just when I repeatedly walk around a corner, they seem to clip into the wall and teleport.
Do you have more than one player object? If not you need to eemove that pick all condition, it will break the rest of your events because it is deselecting your monster onject and defeats the purpose of for each.
If you are pathfinding to 0,0 and only have one player object, there is a separate issue going on.
To check for more than one payer object, in the scene editor click on the “Open the list of instances” icon on the top right. scroll through and check only one instance of player object.
If you don’t have more than one player object, try setting the monster’s pathfinding behaviour to:
extra border size:10, virtual cell width & height to the size of your monster.
I changed the monster’s pathfinding behaviour, and it seems to work better although it still teleports.
I tried removing the raycasting and making it always pathfind and it no longer teleports.
For now, I will probably leave it like that - it was probably how I made the raycasting events that caused it.