Tag Info

New answers tagged

0

Based on user55565's answer, I did some reading on rotation matrices and took his main idea and did some paper sketching. In the end I came up with the class below, which works. The basic idea is to reference the position of the square by its center coordinates. When you want to rotate it, you follow these steps: Calculate the current(before the ...


1

Im not sure this works 100% but here is an idea to get you started. Let your square have x,y as center and r as its current rotation value. Let dx and dy be the displacement from center to one corner of the square when r is 0; On rotate-moving the square on the said corner: First get the corner's position: cx = x + rotated(dx, r); cy = y + rotated(dy, ...



Top 50 recent answers are included