|
| 14 Jul 2017 09:43 PM |
like maybe using an image button, but if they click outside of the circle it wouldn't register as a click
i've never seen it, and just wondering if anyone has or knows how |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2017 09:44 PM |
| You COULD create multiple GUI button to simulate the circular hitbox, but that won't be efficient... |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2017 09:45 PM |
| ye, so like has anyone been able to perfectly do it |
|
|
| Report Abuse |
|
|
doggy00
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 3571 |
|
|
| 14 Jul 2017 09:54 PM |
Let's just make 3600 GUIs and rotate each of them by 0.1 degrees :D
Honestly, that's probably the best way to do this unless there's a way to get the distance from the mouse cursor and the GUI's center. In which case, you could just use that along with an ImageLabel of a circle. |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2017 09:55 PM |
| there has to be a genius that has figured out a different way |
|
|
| Report Abuse |
|
|
KapKing47
|
  |
| Joined: 09 Sep 2012 |
| Total Posts: 5522 |
|
|
| 14 Jul 2017 09:55 PM |
I could make a wrapper for the mouseclick event for buttons and to make it assume that we're using a circle. All that needs to be done is
--Click event if (mouse.Position - centerOfButton).magnitude > buttonSize / 2 then return end --Code here
|
|
|
| Report Abuse |
|
|
|
| 14 Jul 2017 09:57 PM |
what how would that work
could you make a place demonstrating that |
|
|
| Report Abuse |
|
|
doggy00
|
  |
| Joined: 11 Jan 2011 |
| Total Posts: 3571 |
|
|
| 14 Jul 2017 09:59 PM |
| As I said, you would be getting the distance between the GUI button and mouse. This is essentially the radius of the circle. If you ever use magnitude then you'll notice the area it covers always makes a circle (or sphere if you're working with 3D objects). |
|
|
| Report Abuse |
|
|
samy22
|
  |
| Joined: 28 Sep 2008 |
| Total Posts: 2181 |
|
|
| 14 Jul 2017 09:59 PM |
function click() local cc = circleCenterPos local cr = circle radius value local mXpos = mouse.X localmYpos = mouse.Y
if (mXpos - cc.x)^2 + (mYpos - cc.y)^2 < cr^2 then print("Click was in the circle.") end
end |
|
|
| Report Abuse |
|
|
samy22
|
  |
| Joined: 28 Sep 2008 |
| Total Posts: 2181 |
|
|
| 14 Jul 2017 10:00 PM |
Aw.. i was beat to it.
Gotta love time spent trying to fix roblox filter. |
|
|
| Report Abuse |
|
|
KapKing47
|
  |
| Joined: 09 Sep 2012 |
| Total Posts: 5522 |
|
|
| 14 Jul 2017 10:00 PM |
Unfortunately I'm going to sleep now, it's 03:57. But when I wake up I'll get to the code if I don't forget. It should be fairly easy.
local position = Vector2.new(Mouse.X, Mouse.Y) local size = Button.AbsoluteSize local centerOfButton = Button.AbsolutePosition + Button.AbsoluteSize / 2
But I can't remember if it's AbsoluteSize.X (Or .Y) or X.AbsoluteSize (Or Y.), but I'm pretty sure I'm on the right track.
All set.
|
|
|
| Report Abuse |
|
|
|
| 14 Jul 2017 10:01 PM |
| oh wait i get what you mean, thanks |
|
|
| Report Abuse |
|
|