# About usage of Isosceles Right triangle for the grid placement object?

At the end of the lecture, garypettie Said that we can use Isosceles Right triangle for dealing with objects that move on a grid

How Isosceles Right triangle is used for the grid placement object?

is it by using the knowledge of the object’s location and the cell location to know the distance between them?

I think I didn’t make it as it is supposed

I didn’t use Pythagorean Theorem to implement this
and there is no Isosceles Right triangle I made.

Hi @StrivnX,
One example of when this sort of thing will come in handy is for grid-based pathfinding.

To move one space diagonally, you have two options;

• Move along 1 cell and up 1 cell (for a distance of 2 units)
• Move diagonally 1 cell (for a distance of √2 units)

As expected, diagonal movement has a shorter distance (√2 < 2) and a smaller number of cells traversed (1 < 2).

However, if you only work by the number of cells traversed (1 instead of √2) then you may start to encounter problems when you start introducing things like variable movement costs, such as roads increasing movement speed or mud decreasing it.

I hope that helps.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.