Pondering offset-from-center rotation...
Ignis
Member Posts: 72
This has probably come up before: is there a trick or mathematical method to rotate an actor around an "offset point"? A clear example would be a door, when looking top-down on an architectural sketch... the door rotates at its hinge point, not due center.
My first thought was to just off-center the door graphic in a larger image, i.e. the door is 100px wide, but the actual image is 200px wide, with the "visible" part occupying one half of the total. The remainder would be transparent. Of course, this method is ripe with all kinds of problems, most clearly that other actors could collide with the transparent part and the visible part.
I assume this would require some complex math functions to determine that when an actor collides with the "door", it also detects if that actor is touching the visible portion?
Perhaps there's an easier way? (crosses fingers!)
My first thought was to just off-center the door graphic in a larger image, i.e. the door is 100px wide, but the actual image is 200px wide, with the "visible" part occupying one half of the total. The remainder would be transparent. Of course, this method is ripe with all kinds of problems, most clearly that other actors could collide with the transparent part and the visible part.
I assume this would require some complex math functions to determine that when an actor collides with the "door", it also detects if that actor is touching the visible portion?
Perhaps there's an easier way? (crosses fingers!)
Comments
yes, the other way requires trig.
rebump has some good examples on his wall of the necessary math algorithms you would need...