6
\$\begingroup\$

I'm looking to achieve tile by tile movement in a project I'm working on. I employed the use of the asset Simply A* Path-finding to allow a unit to navigate the terrain.

enter image description here

enter image description here

Since the tiles are simply made out of 32x32 sprites, I set the tilesize of the pathfinder to 0.32 to produce the above grid.

However when tested out with a unit, the unit often does not align itself to the center of the sprite as shown in the image below. enter image description here

I am pretty new to unity and would appreciate if someone could input on how I can fix this or advise on an alternate method to allow this "tile to tile" path finding to work.

\$\endgroup\$
0
\$\begingroup\$

http://www.arongranberg.com/astar/docs/modifiers.php#simplesmooth

If you're using Aron Granberg's pathfinder, then are you perhaps using one of the smoothing modifiers? This would result in the unit trying to optimize the path which would probably prevent the unit from hitting each node as it steps through the path.

Or is the problem that you have a consistent offset when the unit paths from node to node?

\$\endgroup\$
0
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.