# What's the use of Rect2.end

Attention Topic was automatically imported from the old Question2Answer platform.

I want to know how far away an object is from the borders of the area. I thought I could use Rect2.position and Rect2.end and comparing the highest values for the bottom and right borders and the lowest numbers for the top and the left borders.

Rect2.end adds the size of the area to the position but it doesnt multiply the size for the units amount so I don’t undestand what it’s use is for. if I add size*8 (the unit amount) to the position then I get the proper opposite corner as I espected.

What is Rect2.end used for?
And is there an easier way to check the distance of an object compared to a border?
I’m using a tilemap and want to know how many tiles in one direction are left to hit the border.

I do not understand this. Where does the 8 come from? Is the size of your tiles? If you know the position of the object and the edge you can use the `Vector2.DistanceTo` function to find out the distance in pixels and then divide that distance by the width of the tile.