Help => Graphics => Topic started by: goodk1d on October 14, 2017, 05:49:26 pm
Title: Using setSize() relative to the origin
Post by: goodk1d on October 14, 2017, 05:49:26 pm
Hello, is there any way to resize a rectangle relative to its center? As far as I know, its origin is only used for rotation, scaling, and positioning. Using .setSize() only resizes relative to the shape's top-left corner.
Currently trying to draw my AABBs for rotating rectangles but I can't figure out how to draw them.
What I have are the minimum vectors of the AABBs (top-left points) and their origin. Is there any workaround to this, or should I just use VertexArrays?
I'd prefer if I didn't have to do the latter, since I've already spent about 3 hours trying to figure out the workaround. ::)
Title: Re: Using setSize() relative to the origin
Post by: dabbertorres on October 14, 2017, 08:18:28 pm
I assume you're actually wanting the origin to be updated relative to the new size.
So,
(click to show/hide)
call setOrigin() after setting the new size
Title: Re: Using setSize() relative to the origin
Post by: goodk1d on October 15, 2017, 03:03:57 am
Ooooh, never thought about it that way. I'm stupid.