[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] rotate around point



Hi, guys. Tks for the answers, but I didnt understand how to rotate it yet.
I made a workaround by putting my arm image inside a blank square cover, so the center of the image is where I want.
This way I can rotate around the center and get the spected result with the arm -> shoulder joint.
But I cant get a good result within forearm -> arm joint.

2012/8/20 Christopher Night <cosmologicon@xxxxxxxxx>

Right, but note that performing step 2 with pygame.transform.rotate is not trivial, since it doesn't rotate about the origin, or any particular point for that matter: the fixed point of rotation depends on the surface dimensions and the rotation angle. So your step 2 is itself 3 steps.

For this reason, I generally anchor all my blits to the surface's center. In this case I would make it easy on myself by adding some margin to the image so that the desired rotation point is at the center of the image. I know not everyone likes to do it that way, though.

-Christopher

On Aug 20, 2012 4:32 PM, "Mark Wexler" <mark.wexler@xxxxxxxxx> wrote:
To rotate around an arbitrary point,
1. subtract (vectorially) the center of rotation;
2. perform rotation (as if about the origin);
3. add the center of rotation.

Mark


On Mon, Aug 20, 2012 at 10:10 PM, Ricardo Franco
<ricardo.krieg@xxxxxxxxx> wrote:
> Hi, I need to rotate around a specific point.
> It's a person animation. So the arms should rotate over the shoulders'
> point.
> How to do that?
>
> --
> Ricardo Franco Andrade             @ricardokrieg
>
> ( Game | Desktop | Web ) Developer
>
> email: ricardo.krieg@xxxxxxxxx
> contact: +55 (86) 9958 9725
>              +55 (86) 9436 0830
> twitter: twitter.com/ricardokrieg
> facebooK: https://www.facebook.com/krieg.ricardo
> github: https://github.com/ricardokrieg
>



--
Mark Wexler
Laboratoire Psychologie de la Perception
CNRS - Université Paris Descartes
45, rue des Saints-Pères
75006 Paris, France
http://wexler.free.fr



--
Ricardo Franco Andrade             @ricardokrieg

( Game | Desktop | Web ) Developer

email: ricardo.krieg@xxxxxxxxx
contact: +55 (86) 9958 9725
             +55 (86) 9436 0830 
twitter: twitter.com/ricardokrieg
facebooK: https://www.facebook.com/krieg.ricardo
github: https://github.com/ricardokrieg