1 min
In mathematics, to check if a point is within the constraints of any area, you can check the lines that create the collider and check if the point is above the top colliders, and below the bottom colliders.
This series of checks allows for a cheap and efficient way to check if you click on an isometric tile, the only pre-requisite is knowledge of how to make the collision area by calculating the lines using two co-ordinates on the line.
if(point.x * line_gradient + line_constant < point.y)
{
point is above line
}
By doing multiple of these checks and returning false if it is outside any of constraints.
Subscribe to this blog via RSS.
Blog 17
Snake 4
Birdman 2
Blog (17) Low-level programming (17) Snake (4) Endless runner (2) Birdman (2) Chess-com (6)