New answers tagged

0

If you have multiple object, then of course you must check each. However, you can first get the closest object to the cursor, and then check if it's inside. Object closestObj = null; // no object selected float closestDist = 50; // all objects are smaller than that, Object currentObj; float currentDist; for each currentObj in sccne { currentDist = ...


0

Now, if the object is a circle, you must use another formula. Suppose that the circle is centered on (centerX, centerY) and its radius is radius. The mouse cursor is inside the circle if... (cursorX - centerX)^2 + (cursorY - centerY)^2 < radius^2 If it's an ellipse where the horizontal radius is radiusX and the vertical radius is radiusY, then the ...


0

"I need to know how to use it to check if the mouse is currently over any of my rendered objects." Suppose that your object is a rectangle with the following attributes: posX: horizontal distance from left of the screen to the first pixel of the object. posY: vertical distance from top of the screen to the first pixel of the object. sizeX: horizontal size....



Top 50 recent answers are included