Talk:GUI Collision Tutorial: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Flurite
No edit summary
>Flurite
No edit summary
Line 6: Line 6:
:::Sorry, I know what I wrote was terrible. :(
:::Sorry, I know what I wrote was terrible. :(
:::Also, how do you add one of those signatures you guys have? (Flurite)
:::Also, how do you add one of those signatures you guys have? (Flurite)
::::Isn't the standard formula for detecting GUIs this?
<pre>
function IsTouching(gui1, gui2)
return gui1.AbsolutePosition.X + math.abs(math.floor(gui1.AbsoluteSize.X)) > gui2.AbsolutePosition.X and
gui2.AbsolutePosition.X + math.abs(math.floor(gui2.AbsoluteSize.X)) > gui1.AbsolutePosition.X and
gui1.AbsolutePosition.Y + math.abs(math.floor(gui1.AbsoluteSize.Y)) > gui2.AbsolutePosition.Y and
gui2.AbsolutePosition.Y + math.abs(math.floor(gui2.AbsoluteSize.Y)) > gui1.AbsolutePosition.Y
end
</pre>

Revision as of 21:35, 21 January 2012

Possible duplicate of Collision_detection_for_GUI's

Trappingnoobs (Writer) Have I done something bad? Good? Tell me on my talk page 15:51, 6 August 2011 (UTC)
That page is terrible
18:41, 6 August 2011 (UTC)
Still, we have two pages for the same thing. :l
Trappingnoobs (Writer) Have I done something bad? Good? Tell me on my talk page 13:36, 7 August 2011 (UTC)


Sorry, I know what I wrote was terrible. :(
Also, how do you add one of those signatures you guys have? (Flurite)
Isn't the standard formula for detecting GUIs this?
function IsTouching(gui1, gui2)
	return gui1.AbsolutePosition.X + math.abs(math.floor(gui1.AbsoluteSize.X)) > gui2.AbsolutePosition.X and
	gui2.AbsolutePosition.X + math.abs(math.floor(gui2.AbsoluteSize.X)) > gui1.AbsolutePosition.X and
	gui1.AbsolutePosition.Y + math.abs(math.floor(gui1.AbsoluteSize.Y)) > gui2.AbsolutePosition.Y and
	gui2.AbsolutePosition.Y + math.abs(math.floor(gui2.AbsoluteSize.Y)) > gui1.AbsolutePosition.Y
end