Pixel Perfect Movement with astar pathfinding

I am building a pixel 2D-platformer game and my game has perfect pixel movement.

Does Unity A* Pathfinding package support perfect pixel movement?

I am currently using seeker.StartPath(startPosition, targetPosition, OnPathComplete) and this is not a pixel perfect movement.

If there is no build-in feature that moves my character with perfect pixel, is there any way around this?



Not 100% sure how large a pixel is in your setup. But there are definitely a few variables you could modify to get better results.

You didn’t specify which movement script you’re using. So I’m going to assume you use the AIPath.

For AIPath you can modify the endReachedDistance but also whenCloseToDestination which by default is Stop, though you could change this for continueToExactPosition

Also there are a few modifiers you can apply on the seeker. See the seeker settings for start and end modifications.

Last but not least, when close to the destination you can Teleport your agent to the final destination. To make sure they are pixel perfect aligned.

Hope that helps

1 Like


That line says nothing about the pixel perfectness, that line only gives you the path but it doesn’t say how you move along it.
There is no built-in movement script that moves characters in a pixel perfect way, however you could write your own. See https://arongranberg.com/astar/docs/custom_movement_script.html