Can you set scrollX and scrollY on hitboxes?


(Blake Jones) #1

So i’m working on some UI buttons and the graphics are being held in place with ScrollX/ScrollY set to zero.

Now if I were to make them clickable they would need hitboxes, BUT there is no scrollX/ScrollY feature for hitboxes(?). I’ve tried masks too but it seems there must be another way to keep the hitbox centered on the graphic.

Thanks for your help.


(Draknek) #2

When detecting collisions, use Input.mouseX/mouseY rather than world.mouseX/mouseY. That’ll give you the mouse position in screen coordinates rather than world coordinates, which if your buttons have scrollX & scrolly = 0, is what you want.


(Blake Jones) #3

thank so much. that worked perfect :slight_smile:


(Zachary Lewis) #4