Login
Community
DARK THEME

How Can I Get The Nearest Point From The Mouse?

I have two points and I wanna know how to get the nearest point from the mouse. Anybody know?

The formula for the distance between two points is

d=√((x2-x1)²+(y2-y1)²)

So in microStudio it could look like this:

dist1 = sqrt((point1x-mouse.x)^2+(point1y-mouse.y)^2)  

dist2 = sqrt((point2x-mouse.x)^2+(point2y-mouse.y)^2)  

Then you just compare these two results. For sure it depends on how you store your point coordinates and other things.
Hope this helps.

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community