generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Better algorithm for ImageGui mouse hover detection

Previous Thread :: Next Thread 
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
20 Jun 2017 04:22 PM
Basically:

I have an ImageButton with a quite irregularly shaped image and need to detect when the mouse is hovering over it. However ROBLOX's crap detection system only detects if the mouse is within the bounding box of the image. I need a better way to detect if the mouse is inside the image (i.e. over a spot that a pixel of the image is occupying).

Any suggestions?


choo choo
Report Abuse
EpicWalnut5 is not online. EpicWalnut5
Joined: 08 Aug 2014
Total Posts: 5104
20 Jun 2017 04:55 PM
you can't

don't blame roblox, that's how technology works
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
20 Jun 2017 05:11 PM
Bud, even Game Maker has the kind of mouse detection I'm describing, and you're telling me that the technology just isn't there yet. LOL. Either you're dumb or you don't understand what I'm asking for. Either way, you shouldn't have replied.


choo choo
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
20 Jun 2017 05:17 PM
You'll have to define vertices around your image and create a mesh overlay, then it's just checking if the mouse is within any given triangle//polygon of the mesh.

Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
20 Jun 2017 05:18 PM
Thank you, I'll look into that.


choo choo
Report Abuse
reeserly is not online. reeserly
Joined: 27 Jan 2017
Total Posts: 2
20 Jun 2017 05:19 PM
ßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßichßich ßichßichßichßichßich ßich ßich ßich
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
20 Jun 2017 08:15 PM
I haven't been able to find anything online on how to "draw" a shape based on given vertices. Any help?


choo choo
Report Abuse
Tunicus is online. Tunicus
Joined: 16 Feb 2013
Total Posts: 3165
20 Jun 2017 08:24 PM
try a convex #### algorithm?
Report Abuse
Tunicus is online. Tunicus
Joined: 16 Feb 2013
Total Posts: 3165
20 Jun 2017 08:25 PM
convex
h
ull
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
20 Jun 2017 09:25 PM
OK so it seems like what I'm really looking for is how many times a given point will intersect the convex #### of an array of points when a ray is shot to the right. Now how do I do that? choo choo
Report Abuse
RegularTetragon is not online. RegularTetragon
Joined: 10 Oct 2009
Total Posts: 3085
20 Jun 2017 09:31 PM
Math, google, and patience.


It's delightful! It's delicious! It's delovely!
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
20 Jun 2017 09:34 PM
Been Googling for the past hour or so, so far no results. I'm still looking though, trying not to give up!


choo choo
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
20 Jun 2017 11:14 PM
Did it. I might be the first person on ROBLOX to use a complex bounds algorithm with an ImageGui for figuring out if the mouse is inside it.


choo choo
Report Abuse
Tunicus is online. Tunicus
Joined: 16 Feb 2013
Total Posts: 3165
20 Jun 2017 11:30 PM
i think i found the algorithm you used and it's much simpler than i expected. bookmarking this for later +1
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
20 Jun 2017 11:35 PM
I used some Lua code I found on StackOverflow.
I literally just Googled "check if point lies in polygon lua".

This is definitely something that will be useful if you use ImageGuis a lot.


choo choo
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image