New answers tagged grid
You could check to which tile the player is closer to and then just set the position of the player to the centre of the tile.
I would look at the problem differently: I would use navigation graph instead. I would "bend" the original navigation graph to your problem - each junction is a node(with 0 radius), and each edge stores its length and its direction. Player navigate on graph instead of in a world full of solid walls. Player can move each frame at desired speed along edge he ...
I would do it like this: If the player wants to go around a corner/change direction, check if the distance he will be able to move in this tick (speed*delta, GREEN ARROW) is bigger than the distance from his center LEFT BLUE DOT to the connecting blocks center ORANGE RECTANGLE. If true: move him to the center of the connection-block ORANGE RECTANGLE and ...
It's been a while since I've worked in Unity, but I believe the problem (or at least part of it) you're having may be that you're using renderer.bounds which gives you the axis aligned bounding box of the object in question. This would mean that when you rotate the bounding box is not rotating, but is in fact growing to fit the rotated object You can test ...
Top 50 recent answers are included