So Im making this isometric click to move game, I’ve hit a problem when moving trough walls per say, so from the screen shot below the white tiles are walls, the tile at the end of the arrow is a wakable tile, the walls have colliders and I managed to make the player collide with it and move back to its original position if the player tries to click move trough the wall, problem is the character flicks back from the collided position to the original position very weirdly, what I really was trying to do is it appear as if the player hadn’t moved at all when trying to walk trough the wall, not sure if colliders is the way to do this, or if I should try to get all the tiles between current player position and the destination tile and check for an invalid tile in between, if that’s the case any tips on how to accomplish that? The walkable and wall tiles are in different layers by the way and the character doesn’t move diagonally
You can use something called A* algorithm (A Star), this would allow you to move the agent to anywhere the player clicks while avoiding obstacles or maybe even not moving at all if there’s no way to get where the player clicked.
A simpler solution would be to make the agent move only in straight lines and stopping when reaching an obstacle, to detect obstacles you could use a Raycast or Linecast, both have a 3D counterpart in case you want to make a 3D game.
Each method has drawbacks, A* would make your game easier to play but the agent wouldn’t move when clicking on an obstacle or outside a grid, while the raycast method would allow you to move even when clicking on an obstacle, but movement would become way more manual.
thanks Yee, I will do some research on those and how to implement it
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
