Iplaydev
|
  |
| Joined: 19 Dec 2011 |
| Total Posts: 292 |
|
|
| 16 Apr 2016 10:55 AM |
gui collision. why can't it be easier?
snort |
|
|
| Report Abuse |
|
|
Notwal
|
  |
| Joined: 31 Dec 2014 |
| Total Posts: 915 |
|
|
| 16 Apr 2016 11:02 AM |
Ikr, the wiki has a script for it, but it's rather painful to look at.
Of course I talk to myself. Sometimes I just need expert advise. |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2016 11:37 AM |
roblox was dumb for now you will have to pythagorus
|
|
|
| Report Abuse |
|
|
|
| 16 Apr 2016 12:16 PM |
Actually since the time i've fixed the over complexity in Moose's code he changed the code on the Wiki since he wrote it. Here is the link to the forum.
https://forum.roblox.com/Forum/ShowPost.aspx?PostID=187243626
but the only line of code you need is
function isTouching(gui1, gui2) local g1p, g1s = gui1.AbsolutePosition, gui1.AbsoluteSize local g2p, g2s = gui2.AbsolutePosition, gui2.AbsoluteSize return ((g1p.x < g2p.x + g2s.x and g1p.x + g1s.x > g2p.x) and (g1p.y < g2p.y + g2s.y and g1p.y + g1s.y > g2p.y)) end |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2016 12:18 PM |
| And you forgot to take in to account ROTATION, since those can collide over other gui too. |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2016 12:21 PM |
| Well I have not tested for rotation but I have a hypothesis that this will still work. |
|
|
| Report Abuse |
|
|
|
| 16 Apr 2016 12:23 PM |
Zindex and Scale are your best friends.
|
|
|
| Report Abuse |
|
|